From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lon Hohberger Date: Tue, 2 Aug 2011 10:50:12 -0400 Subject: [Cluster-devel] [PATCH] rgmanager: Fix race in shutdown vs. notification [RHEL6] Message-ID: <1312296612-24520-1-git-send-email-lhh@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The check of db prior to taking the mutex was done as a tiny performance gain in the event that there was no dbus connection, but causes dbus_connection_get_is_connected() to crash the program if db is NULL. Resolves: rhbz#697446 Signed-off-by: Lon Hohberger --- rgmanager/src/daemons/update-dbus.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c index f465d1d..bff1644 100644 --- a/rgmanager/src/daemons/update-dbus.c +++ b/rgmanager/src/daemons/update-dbus.c @@ -149,12 +149,12 @@ _rgm_dbus_notify(const char *svcname, DBusMessage *msg = NULL; int ret = -1; + pthread_mutex_lock(&mu); + if (!db) { - goto out_free; + goto out_unlock; } - pthread_mutex_lock(&mu); - /* Check to ensure the connection is still valid. If it * isn't, clean up and shut down the dbus connection. * -- 1.7.3.4