Skip to content

Commit

Permalink
Bluetooth: Keep chan->state and sk->sk_state in sync
Browse files Browse the repository at this point in the history
Those vars need to be in sync, otherwise l2cap_core.c can get the wrong
state.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Jan 3, 2012
1 parent 333055f commit 3542b85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/bluetooth/l2cap_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
if (smp_conn_security(conn, sec.level))
break;
sk->sk_state = BT_CONFIG;
chan->state = BT_CONFIG;

/* or for ACL link, under defer_setup time */
} else if (sk->sk_state == BT_CONNECT2 &&
Expand Down Expand Up @@ -731,6 +732,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms

if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) {
sk->sk_state = BT_CONFIG;
pi->chan->state = BT_CONFIG;

__l2cap_connect_rsp_defer(pi->chan);
release_sock(sk);
Expand Down

0 comments on commit 3542b85

Please sign in to comment.