In odd cases (eg., sending a message to yourself), you might call
kdbus_conn_lock2() with A==B. Make sure we lock the connection only once
to not dead-lock.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
*/
static inline void kdbus_conn_lock2(struct kdbus_conn *a, struct kdbus_conn *b)
{
+ if (a == b)
+ b = NULL;
+
if (a < b) {
if (a)
mutex_lock(&a->lock);
static inline void kdbus_conn_unlock2(struct kdbus_conn *a,
struct kdbus_conn *b)
{
+ if (a == b)
+ b = NULL;
+
if (a)
mutex_unlock(&a->lock);
if (b)