Skip to content

Commit a2a8b0b

Browse files
Vudentzholtmann
authored andcommitted
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: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 0830c0a commit a2a8b0b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/bluetooth/l2cap_sock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
605605
break;
606606

607607
case BT_PHY:
608-
if (sk->sk_state == BT_CONNECTED) {
608+
if (sk->sk_state != BT_CONNECTED) {
609609
err = -ENOTCONN;
610610
break;
611611
}

‎net/bluetooth/sco.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname,
958958
break;
959959

960960
case BT_PHY:
961-
if (sk->sk_state == BT_CONNECTED) {
961+
if (sk->sk_state != BT_CONNECTED) {
962962
err = -ENOTCONN;
963963
break;
964964
}

0 commit comments

Comments
 (0)