|
Pablo Greco |
40546a |
From 2b04ec4cfae111f315514395030ab1106b6370da Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <2b04ec4cfae111f315514395030ab1106b6370da@dist-git>
|
|
Pablo Greco |
40546a |
From: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
|
|
Pablo Greco |
40546a |
Date: Fri, 16 Aug 2019 16:01:55 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] virdbus: Grab a ref as long as the while loop is executed
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Grab a ref for info->bus (a DBus connection) as long as the while loop
|
|
Pablo Greco |
40546a |
is running. With the grabbed reference it is ensured that info->bus
|
|
Pablo Greco |
40546a |
isn't freed as long as the while loop is executed. This is necessary
|
|
Pablo Greco |
40546a |
as it's allowed to drop the last ref for the bus connection in a
|
|
Pablo Greco |
40546a |
handler.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
There was already a bug of this kind in libdbus itself:
|
|
Pablo Greco |
40546a |
https://bugs.freedesktop.org/show_bug.cgi?id=15635.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 6707ffd11c1d8940ca7dfa7aaef707a60ef6756e)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
RHEL-8.1.0: https://bugzilla.redhat.com/show_bug.cgi?id=1741900
|
|
Pablo Greco |
40546a |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <9656cea8218d901d5e44a157362cd0f009ff1a7d.1565964111.git.jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/util/virdbus.c | 2 ++
|
|
Pablo Greco |
40546a |
1 file changed, 2 insertions(+)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
|
|
Pablo Greco |
40546a |
index ba8b684f17..d0e2c76e48 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/virdbus.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/virdbus.c
|
|
Pablo Greco |
40546a |
@@ -198,8 +198,10 @@ static void virDBusWatchCallback(int fdatch ATTRIBUTE_UNUSED,
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
(void)dbus_watch_handle(watch, dbus_flags);
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+ dbus_connection_ref(info->bus);
|
|
Pablo Greco |
40546a |
while (dbus_connection_dispatch(info->bus) == DBUS_DISPATCH_DATA_REMAINS)
|
|
Pablo Greco |
40546a |
/* keep dispatching while data remains */;
|
|
Pablo Greco |
40546a |
+ dbus_connection_unref(info->bus);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.1
|
|
Pablo Greco |
40546a |
|