[dpdk-dev] [PATCH 1/2] virtio: fixed segmentation fault in queue_release
Bernard Iremonger
bernard.iremonger at intel.com
Tue Oct 20 17:37:41 CEST 2015
if input parameter vq is NULL, hw = vq->hw, causes a segmentation fault.
Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 465d3cd..147aca1 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);
--
1.9.1
More information about the dev
mailing list