virtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not negotiated

If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL

Signed-off-by: Damjan Marion <damarion@cisco.com>
Acked-by: Changchun Ouyang <Changchun.ouyang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Damjan Marion 2014-09-11 15:25:08 -07:00 committed by Thomas Monjalon
parent e88c3b0a59
commit d68e2ae56b

View File

@ -328,8 +328,10 @@ virtio_dev_cq_start(struct rte_eth_dev *dev)
struct virtio_hw *hw
= VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
virtio_dev_vring_start(hw->cvq, VTNET_CQ);
VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
if (hw->cvq) {
virtio_dev_vring_start(hw->cvq, VTNET_CQ);
VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
}
}
void