Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224924
b: refs/heads/master
c: e0f0cb5
h: refs/heads/master
v: v3
  • Loading branch information
Gustavo F. Padovan committed Dec 1, 2010
1 parent f3da3f2 commit a6d47d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc11b9c14da4ca1c545b424dae2ae8fb1ab04063
refs/heads/master: e0f0cb56364958223f0cb1f1b0b0eecf1b8dcb95
22 changes: 9 additions & 13 deletions trunk/net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,13 @@ static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src)
/* Find socket with psm and source bdaddr.
* Returns closest match.
*/
static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
static struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
{
struct sock *sk = NULL, *sk1 = NULL;
struct hlist_node *node;

read_lock(&l2cap_sk_list.lock);

sk_for_each(sk, node, &l2cap_sk_list.head) {
if (state && sk->sk_state != state)
continue;
Expand All @@ -770,20 +772,10 @@ static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src
sk1 = sk;
}
}
return node ? sk : sk1;
}

/* Find socket with given address (psm, src).
* Returns locked socket */
static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
{
struct sock *s;
read_lock(&l2cap_sk_list.lock);
s = __l2cap_get_sock_by_psm(state, psm, src);
if (s)
bh_lock_sock(s);
read_unlock(&l2cap_sk_list.lock);
return s;

return node ? sk : sk1;
}

static void l2cap_sock_destruct(struct sock *sk)
Expand Down Expand Up @@ -2934,6 +2926,8 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
goto sendresp;
}

bh_lock_sock(parent);

/* Check if the ACL is secure enough (if not SDP) */
if (psm != cpu_to_le16(0x0001) &&
!hci_conn_check_link_mode(conn->hcon)) {
Expand Down Expand Up @@ -4464,6 +4458,8 @@ static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, str
if (!sk)
goto drop;

bh_lock_sock(sk);

BT_DBG("sk %p, len %d", sk, skb->len);

if (sk->sk_state != BT_BOUND && sk->sk_state != BT_CONNECTED)
Expand Down

0 comments on commit a6d47d7

Please sign in to comment.