Re: [syzbot] [bluetooth?] WARNING in ida_free (2)

From: Hillf Danton
Date: Wed Feb 14 2024 - 06:23:42 EST


On Tue, 13 Feb 2024 08:36:20 -0800
> HEAD commit: c664e16bb1ba Merge tag 'docs-6.8-fixes2' of git://git.lwn...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14ee7970180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

--- x/net/bluetooth/hci_conn.c
+++ y/net/bluetooth/hci_conn.c
@@ -970,6 +970,9 @@ struct hci_conn *hci_conn_add(struct hci

bt_dev_dbg(hdev, "dst %pMR handle 0x%4.4x", dst, handle);

+ if (HCI_CONN_HANDLE_UNSET(handle))
+ BUG_ON(!ida_alloc_range(&hdev->unset_handle_ida, handle, handle, GFP_ATOMIC));
+
conn = kzalloc(sizeof(*conn), GFP_KERNEL);
if (!conn)
return NULL;
--