Commit a2a8b0b4 authored by Luiz Augusto von Dentz's avatar Luiz Augusto von Dentz Committed by Marcel Holtmann

Bluetooth: Fix crash when using new BT_PHY option

This fixes the invalid check for connected socket which causes the
following trace due to sco_pi(sk)->conn being NULL:

RIP: 0010:sco_sock_getsockopt+0x2ff/0x800 net/bluetooth/sco.c:966

L2CAP has also been fixed since it has the same problem.
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0830c0a4
...@@ -605,7 +605,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ...@@ -605,7 +605,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
break; break;
case BT_PHY: case BT_PHY:
if (sk->sk_state == BT_CONNECTED) { if (sk->sk_state != BT_CONNECTED) {
err = -ENOTCONN; err = -ENOTCONN;
break; break;
} }
......
...@@ -958,7 +958,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, ...@@ -958,7 +958,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname,
break; break;
case BT_PHY: case BT_PHY:
if (sk->sk_state == BT_CONNECTED) { if (sk->sk_state != BT_CONNECTED) {
err = -ENOTCONN; err = -ENOTCONN;
break; break;
} }
......
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