patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/virtio: fix repeated memory free of vq
@ 2021-07-30 14:34 Gaoxiang Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Gaoxiang Liu @ 2021-07-30 14:34 UTC (permalink / raw)
  To: gaoxiangliu0; +Cc: stable

When virtio_init_queue returns error, the memory of vq is freed.
But the value of hw->vqs[queue_idx] does not restore.`
If hw->vqs[queue_idx] != NULL, the memory of vq is freed again
in virtio_free_queues.

Fixes: 69c80d4ef89b ("net/vritio: allocate queue at init stage")
Cc: stable@dpdk.org

Signed-off-by: Gaoxiang Liu <gaoxiangliu0@163.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 056830566..fc72d71cb 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -631,6 +631,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
 	rte_memzone_free(mz);
 free_vq:
 	rte_free(vq);
+	hw->vqs[queue_idx] = NULL;
 
 	return ret;
 }
-- 
2.32.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-stable] [PATCH] net/virtio: fix repeated memory free of vq
@ 2021-07-30 14:41 Gaoxiang Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Gaoxiang Liu @ 2021-07-30 14:41 UTC (permalink / raw)
  To: Maxime Coquelin, Chenbo Xia; +Cc: dev, liugaoxiang, Gaoxiang Liu, stable

When virtio_init_queue returns error, the memory of vq is freed.
But the value of hw->vqs[queue_idx] does not restore.`
If hw->vqs[queue_idx] != NULL, the memory of vq is freed again
in virtio_free_queues.

Fixes: 69c80d4ef89b ("net/virtio: allocate queue at init stage")
Cc: stable@dpdk.org

Signed-off-by: Gaoxiang Liu <gaoxiangliu0@163.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 056830566..fc72d71cb 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -631,6 +631,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx)
 	rte_memzone_free(mz);
 free_vq:
 	rte_free(vq);
+	hw->vqs[queue_idx] = NULL;
 
 	return ret;
 }
-- 
2.32.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-30 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 14:34 [dpdk-stable] [PATCH] net/virtio: fix repeated memory free of vq Gaoxiang Liu
2021-07-30 14:41 Gaoxiang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).