[PATCH] Fix deadlock in an error path

John (J5) Palmieri johnp at redhat.com
Mon Dec 4 13:39:27 PST 2006


Java was tripping over SELinux when handshaking with the bus and hitting
an error path which caused a deadlock [1].  While we fixed the issue
with SELinux I investigated more and found this bit of interesting code:


void
_dbus_bus_notify_shared_connection_disconnected_unlocked (DBusConnection
*connection)
{
  int i;
  
  _DBUS_LOCK (bus);

...
}

static void
notify_disconnected_unlocked (DBusConnection *connection)
{
  HAVE_LOCK_CHECK (connection);

  _dbus_bus_notify_shared_connection_disconnected_unlocked (connection);

...
}

I believe unlocked functions assume you have a lock already so the
_DBUS_LOCK is wrong.  Attached is a patch which takes it out.

[1]
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=217843
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-1.0.1-dont_lock_in_unlocked_method.patch
Type: text/x-patch
Size: 487 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061204/5504f039/dbus-1.0.1-dont_lock_in_unlocked_method.bin


More information about the dbus mailing list