patch 'net/virtio-user: fix leak when initialisation fails' has been queued to stable release 22.11.3

Xueming Li xuemingl at nvidia.com
Sun Jun 25 08:35:04 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/27/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=2a45186cf44c51ad11e6a8f3d08a0a78a10da952

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 2a45186cf44c51ad11e6a8f3d08a0a78a10da952 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 13 Apr 2023 12:10:41 +0200
Subject: [PATCH] net/virtio-user: fix leak when initialisation fails
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit c8254ef1a96c4897293b1d1db8c8a786dfb19e9d ]

Caught with ASan.
If initialising a virtio_user port fails, we may leak the ifname passed
via a devargs.

Fixes: 4214a1b493f2 ("net/virtio-user: support changing tap interface name")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 19599aa3f6..697a8dcd6b 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -586,11 +586,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 	dev->frontend_features = 0;
 	dev->unsupported_features = 0;
 	dev->backend_type = backend_type;
-
-	if (*ifname) {
-		dev->ifname = *ifname;
-		*ifname = NULL;
-	}
+	dev->ifname = *ifname;
 
 	if (virtio_user_dev_setup(dev) < 0) {
 		PMD_INIT_LOG(ERR, "(%s) backend set up fails", dev->path);
@@ -663,6 +659,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		}
 	}
 
+	*ifname = NULL;
 	return 0;
 }
 
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-25 14:32:00.793771600 +0800
+++ 0086-net-virtio-user-fix-leak-when-initialisation-fails.patch	2023-06-25 14:31:58.465773900 +0800
@@ -1 +1 @@
-From c8254ef1a96c4897293b1d1db8c8a786dfb19e9d Mon Sep 17 00:00:00 2001
+From 2a45186cf44c51ad11e6a8f3d08a0a78a10da952 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c8254ef1a96c4897293b1d1db8c8a786dfb19e9d ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
-index 2b4607a291..af1f8c8237 100644
+index 19599aa3f6..697a8dcd6b 100644
@@ -24 +26 @@
-@@ -696,11 +696,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
+@@ -586,11 +586,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
@@ -37 +39 @@
-@@ -794,6 +790,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
+@@ -663,6 +659,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
@@ -42,0 +45 @@
+ }
@@ -44 +46,0 @@
- notify_uninit:


More information about the stable mailing list