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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 15 03:32:41 CEST 2023


Hi,

FYI, your patch has been queued to stable release 20.11.9

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/17/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://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/1b227ed34a39b5ecd789d19d941a8d91a3cb288b

Thanks.

Luca Boccassi

---
>From 1b227ed34a39b5ecd789d19d941a8d91a3cb288b 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

[ 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 | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 73f6fd7313..cbcd0fedc0 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -475,10 +475,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 
 	parse_mac(dev, mac);
 
-	if (*ifname) {
-		dev->ifname = *ifname;
-		*ifname = NULL;
-	}
+	dev->ifname = *ifname;
 
 	if (virtio_user_dev_setup(dev) < 0) {
 		PMD_INIT_LOG(ERR, "backend set up fails");
@@ -592,6 +589,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		}
 	}
 
+	*ifname = NULL;
 	return 0;
 }
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-15 01:56:37.039629787 +0100
+++ 0046-net-virtio-user-fix-leak-when-initialisation-fails.patch	2023-06-15 01:56:34.663543401 +0100
@@ -1 +1 @@
-From c8254ef1a96c4897293b1d1db8c8a786dfb19e9d Mon Sep 17 00:00:00 2001
+From 1b227ed34a39b5ecd789d19d941a8d91a3cb288b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c8254ef1a96c4897293b1d1db8c8a786dfb19e9d ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -17,2 +18,2 @@
- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
+ drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
@@ -21 +22 @@
-index 2b4607a291..af1f8c8237 100644
+index 73f6fd7313..cbcd0fedc0 100644
@@ -24,5 +25,4 @@
-@@ -696,11 +696,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
- 	dev->frontend_features = 0;
- 	dev->unsupported_features = 0;
- 	dev->backend_type = backend_type;
--
+@@ -475,10 +475,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
+ 
+ 	parse_mac(dev, mac);
+ 
@@ -36,2 +36,2 @@
- 		PMD_INIT_LOG(ERR, "(%s) backend set up fails", dev->path);
-@@ -794,6 +790,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
+ 		PMD_INIT_LOG(ERR, "backend set up fails");
+@@ -592,6 +589,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
@@ -42,0 +43 @@
+ }
@@ -44 +44,0 @@
- notify_uninit:


More information about the stable mailing list