From: Bernard Iremonger Date: Tue, 20 Oct 2015 15:37:41 +0000 (+0100) Subject: virtio: fix crash when releasing null queue X-Git-Tag: spdx-start~8377 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ce8e121870d21e5ad5c6d1a21d0214e95e7a2fd2;p=dpdk.git virtio: fix crash when releasing null queue if input parameter vq is NULL, hw = vq->hw, causes a segmentation fault. Signed-off-by: Bernard Iremonger Acked-by: Stephen Hemminger --- diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 9a35112e3c..4f75cff4b0 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -48,6 +48,10 @@ Drivers Fixed io permission in the interrupt handler. +* **virtio: Fixed crash when releasing queue.** + + Fixed issue when releasing null control queue. + Libraries ~~~~~~~~~ diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 465d3cde59..147aca1504 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -239,9 +239,10 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, uint16_t nb_queues) void virtio_dev_queue_release(struct virtqueue *vq) { - struct virtio_hw *hw = vq->hw; + struct virtio_hw *hw; if (vq) { + hw = vq->hw; /* Select and deactivate the queue */ VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vq->queue_id); VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN, 0);