cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Fix race in shutdown vs. notification [RHEL6]
Date: Tue,  2 Aug 2011 10:50:12 -0400	[thread overview]
Message-ID: <1312296612-24520-1-git-send-email-lhh@redhat.com> (raw)

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 <lhh@redhat.com>
---
 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



             reply	other threads:[~2011-08-02 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 14:50 Lon Hohberger [this message]
2011-08-02 15:06 ` [Cluster-devel] [PATCH] rgmanager: Fix race in shutdown vs. notification [RHEL6] Fabio M. Di Nitto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312296612-24520-1-git-send-email-lhh@redhat.com \
    --to=lhh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).