Luiz Augusto von Dentz
064c1fea79
Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times
[ Upstream commit 448a496f76 ]
device_add shall not be called multiple times as stated in its
documentation:
'Do not call this routine or device_register() more than once for
any device structure'
Syzkaller reports a bug as follows [1]:
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:33!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
[...]
Call Trace:
<TASK>
__list_add include/linux/list.h:69 [inline]
list_add_tail include/linux/list.h:102 [inline]
kobj_kset_join lib/kobject.c:164 [inline]
kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214
kobject_add_varg lib/kobject.c:358 [inline]
kobject_add+0x150/0x1c0 lib/kobject.c:410
device_add+0x368/0x1e90 drivers/base/core.c:3452
hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53
hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799
hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110
hci_event_func net/bluetooth/hci_event.c:7440 [inline]
hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495
hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>
Link: https://syzkaller.appspot.com/bug?id=da3246e2d33afdb92d66bc166a0934c5b146404a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tested-by: Hawkins Jiawei <yin31149@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-13 14:13:35 +09:00
..
2023-05-15 16:44:57 +09:00
2023-06-13 14:13:22 +09:00
2023-05-16 11:34:46 +09:00
2023-05-15 16:32:51 +09:00
2023-05-16 10:49:55 +09:00
2023-05-16 09:16:14 +09:00
2023-05-16 12:45:55 +09:00
2023-05-16 12:46:11 +09:00
2023-06-13 14:13:35 +09:00
2023-06-13 14:13:27 +09:00
2023-05-16 11:46:39 +09:00
2023-05-16 12:34:33 +09:00
2023-05-16 09:45:38 +09:00
2023-06-13 14:13:24 +09:00
2023-05-16 12:44:53 +09:00
2023-05-16 11:46:42 +09:00
2023-05-16 11:34:05 +09:00
2023-05-12 16:29:40 +09:00
2023-05-15 17:13:02 +09:00
2023-05-15 16:31:00 +09:00
2023-05-16 10:54:56 +09:00
2023-06-13 14:13:30 +09:00
2023-06-13 14:13:35 +09:00
2023-06-13 14:13:19 +09:00
2017-05-25 15:44:41 +02:00
2023-05-12 17:27:16 +09:00
2023-05-16 09:50:42 +09:00
2023-05-15 12:22:31 +09:00
2023-06-13 14:13:24 +09:00
2023-06-13 14:13:12 +09:00
2016-09-10 23:12:53 -07:00
2023-05-16 10:34:08 +09:00
2023-05-16 12:47:02 +09:00
2023-06-13 14:13:32 +09:00
2023-06-13 14:13:26 +09:00
2023-05-16 10:46:16 +09:00
2023-05-16 10:24:55 +09:00
2023-06-13 14:13:28 +09:00
2023-05-16 12:33:58 +09:00
2023-06-13 14:12:48 +09:00
2023-05-16 11:34:06 +09:00
2023-06-13 14:12:53 +09:00
2023-06-13 14:13:35 +09:00
2023-06-13 14:12:43 +09:00
2023-05-16 12:30:20 +09:00
2023-05-16 10:49:33 +09:00
2023-06-13 14:13:33 +09:00
2023-05-15 16:32:30 +09:00
2023-06-13 14:13:24 +09:00
2023-06-13 14:12:54 +09:00
2023-06-13 14:13:27 +09:00
2023-06-13 14:12:54 +09:00
2018-04-29 11:32:02 +02:00
2023-06-13 14:13:27 +09:00
2016-10-19 10:58:04 -04:00
2023-06-13 14:13:27 +09:00
2023-05-16 12:33:30 +09:00
2023-06-13 14:13:23 +09:00
2015-08-09 22:43:52 -07:00
2023-06-13 14:13:08 +09:00
2023-06-13 14:13:26 +09:00
2023-06-13 14:12:38 +09:00
2023-06-13 14:13:35 +09:00
2023-05-16 11:14:47 +09:00
2023-05-15 17:31:52 +09:00
2023-05-16 11:34:41 +09:00
2023-06-13 14:13:24 +09:00
2016-10-06 09:52:23 -07:00