net/virtio: Fix crash in virtio_dev_free_mbufs
PATCH 1/1 net/virtio: Fix crash in virtio_dev_free_mbufs
virtio_dev_free_mbufs was recently modified to free the virtqueues but failed to check whether the array was allocated. Added a check to ensure vqs was non-null.
--- drivers/net/virtio/virtio_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/virtio/virtio_ethdev.c +3 -0
@@ -1975,6 +1975,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)struct rte_mbuf *buf;int queue_type; +if (hw->vqs ==NULL ) +return ; +for (i =0 ; i < nr_vq; i++) { vq = hw->vqs[i];if (!vq)
Signature · 1 line
2.10.3.dirty
Quoted 9 lines · David C Harton
virtio_dev_free_mbufswas recently modified to free the virtqueues but failed to check whether the array was allocated. Added a check to ensure vqs was non-null.Fixes bdb32afbb610 ("net/virtio: rationalize queue flushing")Signed-off-by David C Harton <[email protected]>---
Thank you for this fix.
Out of curiosity, did you see the problem by code review or is there an easy way to reproduce the crash?
Quoted 18 lines · David C Harton
virtio_dev_free_mbufswas recently modified to free the virtqueues but failed to check whether the array was allocated. Added a check to ensure vqs was non-null.Fixes bdb32afbb610 ("net/virtio: rationalize queue flushing")Signed-off-by David C Harton <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/virtio/virtio_ethdev.c +0
-0
drivers/net/virtio/virtio_ethdev.c static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) · line 1983
Quoted 9 lines
drivers/net/virtio/virtio_ethdev.c +3
-0@@ -1975,6 +1975,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)struct rte_mbuf *buf;int queue_type; +if (hw->vqs ==NULL ) +return ; +for (i =0 ; i < nr_vq; i++) { vq = hw->vqs[i];if (!vq)
Thanks,
Maxime
Quoted 8 lines · David C Harton
virtio_dev_free_mbufswas recently modified to free the virtqueues but failed to check whether the array was allocated. Added a check to ensure vqs was non-null.Fixes bdb32afbb610 ("net/virtio: rationalize queue flushing")Signed-off-by David C Harton <[email protected]>
[1] Signed-off-by: David Harton <[email protected]>
Applied to dpdk-next-net/master, thanks.
[1]
Hi David,
Since your previous commits has "David Harton" name, to prevent seen as a new person, I kept same name, fyi.