Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in l2cap_connect (2)

From: Edward Adam Davis
Date: Sat Sep 07 2024 - 22:12:55 EST


after release conn, we need to cancle rx_work

#syz test

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 8e48ccd2af30..5050d20e9cd1 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1264,6 +1264,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status)
conn->state = BT_CLOSED;
hci_connect_cfm(conn, status);
hci_conn_del(conn);
+ cancel_work_sync(&hdev->rx_work);
}

/* This function requires the caller holds hdev->lock */