Commit 280f294f authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Don't lock sock inside l2cap_get_sock_by_scid()

Fix an locking issue with the new l2cap_att_channel(). l2cap_att_channel()
was trying to lock a locked socket.
Reported-by: default avatarAnderson Lizardo <anderson.lizardo@openbossa.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 9f72c1d9
...@@ -594,7 +594,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn) ...@@ -594,7 +594,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
*/ */
static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src) static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src)
{ {
struct sock *s, *sk = NULL, *sk1 = NULL; struct sock *sk = NULL, *sk1 = NULL;
struct hlist_node *node; struct hlist_node *node;
read_lock(&l2cap_sk_list.lock); read_lock(&l2cap_sk_list.lock);
...@@ -613,12 +613,10 @@ static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src) ...@@ -613,12 +613,10 @@ static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src)
sk1 = sk; sk1 = sk;
} }
} }
s = node ? sk : sk1;
if (s)
bh_lock_sock(s);
read_unlock(&l2cap_sk_list.lock); read_unlock(&l2cap_sk_list.lock);
return s; return node ? sk : sk1;
} }
static void l2cap_le_conn_ready(struct l2cap_conn *conn) static void l2cap_le_conn_ready(struct l2cap_conn *conn)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment