Commit c1a988bb authored by Maksim Krasnyanskiy's avatar Maksim Krasnyanskiy

Fix L2CAP client/server PSM clash.

parent e01408ad
...@@ -224,6 +224,8 @@ struct l2cap_pinfo { ...@@ -224,6 +224,8 @@ struct l2cap_pinfo {
__u8 ident; __u8 ident;
__u16 sport;
struct l2cap_conn *conn; struct l2cap_conn *conn;
struct sock *next_c; struct sock *next_c;
struct sock *prev_c; struct sock *prev_c;
......
...@@ -191,8 +191,7 @@ static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src) ...@@ -191,8 +191,7 @@ static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src)
{ {
struct sock *sk; struct sock *sk;
for (sk = l2cap_sk_list.head; sk; sk = sk->next) { for (sk = l2cap_sk_list.head; sk; sk = sk->next) {
if (l2cap_pi(sk)->psm == psm && if (l2cap_pi(sk)->sport == psm && !bacmp(&bt_sk(sk)->src, src))
!bacmp(&bt_sk(sk)->src, src))
break; break;
} }
return sk; return sk;
...@@ -417,6 +416,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ ...@@ -417,6 +416,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
/* Save source address */ /* Save source address */
bacpy(&bt_sk(sk)->src, &la->l2_bdaddr); bacpy(&bt_sk(sk)->src, &la->l2_bdaddr);
l2cap_pi(sk)->psm = la->l2_psm; l2cap_pi(sk)->psm = la->l2_psm;
l2cap_pi(sk)->sport = la->l2_psm;
sk->state = BT_BOUND; sk->state = BT_BOUND;
} }
write_unlock_bh(&l2cap_sk_list.lock); write_unlock_bh(&l2cap_sk_list.lock);
......
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