Commit 3542b854 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Keep chan->state and sk->sk_state in sync

Those vars need to be in sync, otherwise l2cap_core.c can get the wrong
state.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 333055f2
...@@ -587,6 +587,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch ...@@ -587,6 +587,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
if (smp_conn_security(conn, sec.level)) if (smp_conn_security(conn, sec.level))
break; break;
sk->sk_state = BT_CONFIG; sk->sk_state = BT_CONFIG;
chan->state = BT_CONFIG;
/* or for ACL link, under defer_setup time */ /* or for ACL link, under defer_setup time */
} else if (sk->sk_state == BT_CONNECT2 && } else if (sk->sk_state == BT_CONNECT2 &&
...@@ -731,6 +732,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms ...@@ -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) { if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) {
sk->sk_state = BT_CONFIG; sk->sk_state = BT_CONFIG;
pi->chan->state = BT_CONFIG;
__l2cap_connect_rsp_defer(pi->chan); __l2cap_connect_rsp_defer(pi->chan);
release_sock(sk); release_sock(sk);
......
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