diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-13 18:01:22 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-13 18:01:22 -0400 |
commit | 280f294f7bd0c14d9f802a551c95dc930e31d723 (patch) | |
tree | bbaafef3334a85d339ff07cff622fcb58b4ef806 /net/bluetooth | |
parent | 9f72c1d977e47a7d182d49ea131067cba0a96ab8 (diff) |
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: Anderson Lizardo <anderson.lizardo@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index c9c1f9257a91..d5db5a38df6a 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -594,7 +594,7 @@ static void l2cap_conn_start(struct l2cap_conn *conn) | |||
594 | */ | 594 | */ |
595 | static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src) | 595 | static struct sock *l2cap_get_sock_by_scid(int state, __le16 cid, bdaddr_t *src) |
596 | { | 596 | { |
597 | struct sock *s, *sk = NULL, *sk1 = NULL; | 597 | struct sock *sk = NULL, *sk1 = NULL; |
598 | struct hlist_node *node; | 598 | struct hlist_node *node; |
599 | 599 | ||
600 | read_lock(&l2cap_sk_list.lock); | 600 | 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 | sk1 = sk; | 613 | sk1 = sk; |
614 | } | 614 | } |
615 | } | 615 | } |
616 | s = node ? sk : sk1; | 616 | |
617 | if (s) | ||
618 | bh_lock_sock(s); | ||
619 | read_unlock(&l2cap_sk_list.lock); | 617 | read_unlock(&l2cap_sk_list.lock); |
620 | 618 | ||
621 | return s; | 619 | return node ? sk : sk1; |
622 | } | 620 | } |
623 | 621 | ||
624 | static void l2cap_le_conn_ready(struct l2cap_conn *conn) | 622 | static void l2cap_le_conn_ready(struct l2cap_conn *conn) |