connection: fix dead-lock on policy-removal
authorDavid Herrmann <dh.herrmann@gmail.com>
Mon, 12 Jan 2015 11:39:03 +0000 (12:39 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Mon, 12 Jan 2015 11:39:03 +0000 (12:39 +0100)
commit99e6b9789bb569848629b84cf5c9654f8c3bc8cc
tree7c809fc98238752b127fbef5eb39c0d010a2b0d7
parentc9246acd6058e3e2c75f99411f7c75a330994074
connection: fix dead-lock on policy-removal

If we clear the policy-db on last kdbus_conn_unref(), we have to take the
policy semaphore. However, we allow calling kdbus_conn_unref() while
holding a connection lock. This might deadlock against normal policy-db
modifications.

Therefore, we move policy-setup _after_ kdbus_conn_connect() and ensure
the connection is active. Then we can move the policy-removal into
kdbus_conn_disconnect(), which itself must never be called while holding
any lock.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection.c
handle.c