Bluetooth: Fix crash when using new BT_PHY option
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 Bluetooth: Fix crash when using new BT_PHY option
From: Luiz Augusto von Dentz <[email protected]>
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 <[email protected]>
--- net/bluetooth/l2cap_sock.c | 2 +- net/bluetooth/sco.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/l2cap_sock.c +1 -1
@@ -605,7 +605,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,break ;case BT_PHY : -if (sk->sk_state ==BT_CONNECTED ) { +if (sk->sk_state !=BT_CONNECTED ) { err = -ENOTCONN ;break ; }
net/bluetooth/sco.c +1 -1
@@ -958,7 +958,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname,break ;case BT_PHY : -if (sk->sk_state ==BT_CONNECTED ) { +if (sk->sk_state !=BT_CONNECTED ) { err = -ENOTCONN ;break ; }
Signature · 1 line
2.21.1
Luiz Augusto von Dentz
maintainerHi,
Quoted 43 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
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:966L2CAP has also been fixed since it has the same problem.
Signed-off-by Luiz Augusto von Dentz <[email protected]>--- net/bluetooth/l2cap_sock.c | 2 +- net/bluetooth/sco.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)net/bluetooth/l2cap_sock.c +1
-1@@ -605,7 +605,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,break ;case BT_PHY : -if (sk->sk_state ==BT_CONNECTED ) { +if (sk->sk_state !=BT_CONNECTED ) { err = -ENOTCONN ;break ; }net/bluetooth/sco.c +1
-2@@ -958,7 +958,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname,break ;case BT_PHY : -if (sk->sk_state ==BT_CONNECTED ) { +if (sk->sk_state !=BT_CONNECTED ) { err = -ENOTCONN ;break ; } --
Quoted 1 line
2.21.1
Please disregard this one, it was sent by mistake.
Signature · 1 line
Luiz Augusto von Dentz