net/virtio: fix null pointer dereference
authorJianfeng Tan <jianfeng.tan@intel.com>
Tue, 5 Jul 2016 11:42:59 +0000 (11:42 +0000)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 5 Jul 2016 12:14:40 +0000 (14:14 +0200)
commit3bd60a27e9f2afacff70f6aafdca0fc18685633f
treef9152a23eec56eacc747802fbdc499b03ee14481
parentc34673bb005e0d219c8774fe97e43067ab1d56a7
net/virtio: fix null pointer dereference

There is a logic bug in this code, that could lead to null pointer
dereference when cvq is NULL. Fix this problem by changing logic
&& to logic ||.

   >> CID 127480:  Null pointer dereferences  (FORWARD_NULL)
   >> Dereferencing null pointer "cvq".
    if (!cvq && !cvq->vq) {
            ...
        }

Coverity issue: 127480
Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c