[PATCH] Fix deadlock in an error path
John (J5) Palmieri
johnp at redhat.com
Mon Dec 4 16:09:03 PST 2006
On Mon, 2006-12-04 at 18:55 -0500, Havoc Pennington wrote:
> John (J5) Palmieri wrote:
> > 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);
>
> I think this is just a mistake in naming the function. _unlocked usually
> refers to the connection lock, but this is the global lock in dbus-bus.c
> which is different. I don't know a reason that the dbus-bus.c lock would
> be held already when calling this.
There is only one function that calls it:
static void
notify_disconnected_unlocked (DBusConnection *connection)
{
HAVE_LOCK_CHECK (connection);
_dbus_bus_notify_shared_connection_disconnected_unlocked (connection);
...
}
which indeed checks to see if there is a lock so
_dbus_bus_notify_shared_connection_disconnected_unlocked needs to assume
there is a lock.
--
John (J5) Palmieri <johnp at redhat.com>
More information about the dbus
mailing list