[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250222114809.11634-1-aha310510@gmail.com>
Date: Sat, 22 Feb 2025 20:48:09 +0900
From: Jeongjun Park <aha310510@...il.com>
To: marcel@...tmann.org,
johan.hedberg@...il.com,
luiz.dentz@...il.com
Cc: gustavo.padovan@...labora.co.uk,
andre.guedes@...nbossa.org,
linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jeongjun Park <aha310510@...il.com>
Subject: [PATCH] Bluetooth: SCO: fix ABBA deadlock in sco_connect_cfm
Caused by previous commit 405280887f8f causes ABBA deadlock. So we need to
change the lock order to prevent deadlock.
Fixes: 405280887f8f ("Bluetooth: Reduce critical section in sco_conn_ready")
Signed-off-by: Jeongjun Park <aha310510@...il.com>
---
net/bluetooth/sco.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index aa7bfe26cb40..8f1377f4a27c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -289,13 +289,11 @@ static int sco_chan_add(struct sco_conn *conn, struct sock *sk,
{
int err = 0;
- sco_conn_lock(conn);
if (conn->sk)
err = -EBUSY;
else
__sco_chan_add(conn, sk, parent);
- sco_conn_unlock(conn);
return err;
}
@@ -343,11 +341,13 @@ static int sco_connect(struct sock *sk)
goto unlock;
}
+ sco_conn_lock(conn);
lock_sock(sk);
err = sco_chan_add(conn, sk, NULL);
if (err) {
release_sock(sk);
+ sco_conn_unlock(conn);
goto unlock;
}
@@ -363,6 +363,7 @@ static int sco_connect(struct sock *sk)
}
release_sock(sk);
+ sco_conn_unlock(conn);
unlock:
hci_dev_unlock(hdev);
--
Powered by blists - more mailing lists