|
Daniel P. Berrangé |
9ae002 |
From 3499354e12a1c1832bf4030693a64e03ceb79d05 Mon Sep 17 00:00:00 2001
|
|
Daniel P. Berrangé |
9ae002 |
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
Daniel P. Berrangé |
9ae002 |
Date: Wed, 5 Jun 2024 11:16:21 +0100
|
|
Daniel P. Berrangé |
9ae002 |
Subject: [PATCH] interface: fix udev reference leak with invalid flags
|
|
Daniel P. Berrangé |
9ae002 |
MIME-Version: 1.0
|
|
Daniel P. Berrangé |
9ae002 |
Content-Type: text/plain; charset=UTF-8
|
|
Daniel P. Berrangé |
9ae002 |
Content-Transfer-Encoding: 8bit
|
|
Daniel P. Berrangé |
9ae002 |
|
|
Daniel P. Berrangé |
9ae002 |
The udevInterfaceGetXMLDesc method takes a reference on the udev
|
|
Daniel P. Berrangé |
9ae002 |
driver as its first action. If the virCheckFlags() condition
|
|
Daniel P. Berrangé |
9ae002 |
fails, however, this reference is never released.
|
|
Daniel P. Berrangé |
9ae002 |
|
|
Daniel P. Berrangé |
9ae002 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
Daniel P. Berrangé |
9ae002 |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Daniel P. Berrangé |
9ae002 |
---
|
|
Daniel P. Berrangé |
9ae002 |
src/interface/interface_backend_udev.c | 4 +++-
|
|
Daniel P. Berrangé |
9ae002 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
Daniel P. Berrangé |
9ae002 |
|
|
Daniel P. Berrangé |
9ae002 |
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
|
|
Daniel P. Berrangé |
9ae002 |
index fdf11a8318..e1a50389c9 100644
|
|
Daniel P. Berrangé |
9ae002 |
--- a/src/interface/interface_backend_udev.c
|
|
Daniel P. Berrangé |
9ae002 |
+++ b/src/interface/interface_backend_udev.c
|
|
Daniel P. Berrangé |
9ae002 |
@@ -1027,12 +1027,14 @@ static char *
|
|
Daniel P. Berrangé |
9ae002 |
udevInterfaceGetXMLDesc(virInterfacePtr ifinfo,
|
|
Daniel P. Berrangé |
9ae002 |
unsigned int flags)
|
|
Daniel P. Berrangé |
9ae002 |
{
|
|
Daniel P. Berrangé |
9ae002 |
- struct udev *udev = udev_ref(driver->udev);
|
|
Daniel P. Berrangé |
9ae002 |
+ struct udev *udev = NULL;
|
|
Daniel P. Berrangé |
9ae002 |
g_autoptr(virInterfaceDef) ifacedef = NULL;
|
|
Daniel P. Berrangé |
9ae002 |
char *xmlstr = NULL;
|
|
Daniel P. Berrangé |
9ae002 |
|
|
Daniel P. Berrangé |
9ae002 |
virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
|
|
Daniel P. Berrangé |
9ae002 |
|
|
Daniel P. Berrangé |
9ae002 |
+ udev = udev_ref(driver->udev);
|
|
Daniel P. Berrangé |
9ae002 |
+
|
|
Daniel P. Berrangé |
9ae002 |
/* Recursively build up the interface XML based on the requested
|
|
Daniel P. Berrangé |
9ae002 |
* interface name
|
|
Daniel P. Berrangé |
9ae002 |
*/
|
|
Daniel P. Berrangé |
9ae002 |
--
|
|
Daniel P. Berrangé |
9ae002 |
2.45.1
|
|
Daniel P. Berrangé |
9ae002 |
|