mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: L2CAP: fix an illegal state transition from BT_DISCONN
@ 2022-09-26 20:46 Sungwoo Kim
  2022-09-26 21:33 ` Luiz Augusto von Dentz
  2022-09-27 11:26 ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Sungwoo Kim @ 2022-09-26 20:46 UTC (permalink / raw)
  Cc: syzkaller, Sungwoo Kim, Marcel Holtmann, Johan Hedberg,
	Luiz Augusto von Dentz, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-bluetooth, netdev,
	linux-kernel

Prevent an illegal state transition from BT_DISCONN to BT_CONFIG.
L2CAP_CONN_RSP and L2CAP_CREATE_CHAN_RSP events should be ignored
for BT_DISCONN state according to the Bluetooth Core v5.3 p.1096.
It is found by BTFuzz, a modified version of syzkaller.

Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
---
 net/bluetooth/l2cap_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2c9de67da..a15d64b13 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4307,6 +4307,9 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
 		}
 	}
 
+	if (chan->state == BT_DISCONN)
+		goto unlock;
+
 	err = 0;
 
 	l2cap_chan_lock(chan);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-27 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 20:46 [PATCH] Bluetooth: L2CAP: fix an illegal state transition from BT_DISCONN Sungwoo Kim
2022-09-26 21:33 ` Luiz Augusto von Dentz
2022-09-26 22:02   ` Sungwoo Kim
2022-09-26 22:40     ` Luiz Augusto von Dentz
2022-09-27 11:26 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®