All of lore.kernel.org
 help / color / mirror / Atom feed
* INFO: trying to register non-static key in hci_uart_flush (2)
@ 2019-09-03 19:04 syzbot
  2019-09-24 12:09 ` syzbot
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2019-09-03 19:04 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, marcel, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    6d028043 Add linux-next specific files for 20190830
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=141d6cae600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=82a6bec43ab0cb69
dashboard link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+576dfca25381fb6fbc5f@syzkaller.appspotmail.com

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 31436 Comm: syz-executor.2 Not tainted 5.3.0-rc6-next-20190830  
#75
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
  assign_lock_key kernel/locking/lockdep.c:881 [inline]
  register_lock_class+0x179e/0x1850 kernel/locking/lockdep.c:1190
  __lock_acquire+0xf4/0x4a00 kernel/locking/lockdep.c:3837
  lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4487
  percpu_down_read include/linux/percpu-rwsem.h:40 [inline]
  hci_uart_flush+0x110/0x510 drivers/bluetooth/hci_ldisc.c:241
  hci_uart_close drivers/bluetooth/hci_ldisc.c:267 [inline]
  hci_uart_tty_close+0x8e/0x280 drivers/bluetooth/hci_ldisc.c:534
  tty_ldisc_close.isra.0+0x119/0x1a0 drivers/tty/tty_ldisc.c:494
  tty_ldisc_kill+0x9c/0x160 drivers/tty/tty_ldisc.c:642
  tty_ldisc_release+0xe9/0x2b0 drivers/tty/tty_ldisc.c:814
  tty_release_struct+0x1b/0x50 drivers/tty/tty_io.c:1612
  tty_release+0xbcb/0xe90 drivers/tty/tty_io.c:1785
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  get_signal+0x2078/0x2500 kernel/signal.c:2528
  do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
  exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
  prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
  do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459879
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f5b36328c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000459879
RDX: 0000000000000002 RSI: 00000000400455c8 RDI: 0000000000000003
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5b363296d4
R13: 00000000004c2586 R14: 00000000004d5ae8 R15: 00000000ffffffff
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 31436 Comm: syz-executor.2 Not tainted 5.3.0-rc6-next-20190830  
#75
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:__wake_up_common+0xdf/0x610 kernel/sched/wait.c:86
Code: 05 00 00 4c 8b 43 38 49 83 e8 18 49 8d 78 18 48 39 7d d0 0f 84 64 02  
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 <80> 3c 01 00 0f  
85 0d 05 00 00 49 8b 40 18 89 55 b0 31 db 49 bc 00
RSP: 0018:ffff8880979bf818 EFLAGS: 00010046
RAX: dffffc0000000000 RBX: ffff8880a7ff48b8 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 1ffffffff138b536 RDI: 0000000000000000
RBP: ffff8880979bf870 R08: ffffffffffffffe8 R09: 0000000000000000
R10: ffffed1012f37efe R11: 0000000000000003 R12: ffff8880a7ff4900
R13: ffff8880a7ff48b0 R14: 0000000000000000 R15: ffff8880a7ff48b8
FS:  00007f5b36329700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff600400 CR3: 00000000a81a2000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  __wake_up_locked+0x11/0x20 kernel/sched/wait.c:151
  rcu_sync_func+0x16f/0x200 kernel/rcu/sync.c:87
  rcu_sync_enter+0x158/0x310 kernel/rcu/sync.c:150
  percpu_down_write+0x61/0x440 kernel/locking/percpu-rwsem.c:146
  hci_uart_tty_close+0x154/0x280 drivers/bluetooth/hci_ldisc.c:537
  tty_ldisc_close.isra.0+0x119/0x1a0 drivers/tty/tty_ldisc.c:494
  tty_ldisc_kill+0x9c/0x160 drivers/tty/tty_ldisc.c:642
  tty_ldisc_release+0xe9/0x2b0 drivers/tty/tty_ldisc.c:814
  tty_release_struct+0x1b/0x50 drivers/tty/tty_io.c:1612
  tty_release+0xbcb/0xe90 drivers/tty/tty_io.c:1785
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  get_signal+0x2078/0x2500 kernel/signal.c:2528
  do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
  exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
  prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
  do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459879
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f5b36328c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000459879
RDX: 0000000000000002 RSI: 00000000400455c8 RDI: 0000000000000003
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5b363296d4
R13: 00000000004c2586 R14: 00000000004d5ae8 R15: 00000000ffffffff
Modules linked in:
---[ end trace d1da9c36c5e69966 ]---
RIP: 0010:__wake_up_common+0xdf/0x610 kernel/sched/wait.c:86
Code: 05 00 00 4c 8b 43 38 49 83 e8 18 49 8d 78 18 48 39 7d d0 0f 84 64 02  
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 <80> 3c 01 00 0f  
85 0d 05 00 00 49 8b 40 18 89 55 b0 31 db 49 bc 00
RSP: 0018:ffff8880979bf818 EFLAGS: 00010046
RAX: dffffc0000000000 RBX: ffff8880a7ff48b8 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 1ffffffff138b536 RDI: 0000000000000000
RBP: ffff8880979bf870 R08: ffffffffffffffe8 R09: 0000000000000000
R10: ffffed1012f37efe R11: 0000000000000003 R12: ffff8880a7ff4900
R13: ffff8880a7ff48b0 R14: 0000000000000000 R15: ffff8880a7ff48b8
FS:  00007f5b36329700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff600400 CR3: 00000000a81a2000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

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

* Re: INFO: trying to register non-static key in hci_uart_flush (2)
  2019-09-03 19:04 INFO: trying to register non-static key in hci_uart_flush (2) syzbot
@ 2019-09-24 12:09 ` syzbot
  2022-08-29 14:58   ` [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Tetsuo Handa
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2019-09-24 12:09 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, marcel, syzkaller-bugs

syzbot has found a reproducer for the following crash on:

HEAD commit:    e94f8ccd Merge tag 'smack-for-5.4-rc1' of git://github.com..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16713de9600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df38eec565aab18d
dashboard link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12881a9d600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+576dfca25381fb6fbc5f@syzkaller.appspotmail.com

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 9385 Comm: syz-executor.3 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
  assign_lock_key kernel/locking/lockdep.c:881 [inline]
  register_lock_class+0x179e/0x1850 kernel/locking/lockdep.c:1190
  __lock_acquire+0xf4/0x4e70 kernel/locking/lockdep.c:3837
  lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4487
  percpu_down_read include/linux/percpu-rwsem.h:40 [inline]
  hci_uart_flush+0x110/0x510 drivers/bluetooth/hci_ldisc.c:241
  hci_uart_close drivers/bluetooth/hci_ldisc.c:267 [inline]
  hci_uart_tty_close+0x8e/0x280 drivers/bluetooth/hci_ldisc.c:534
  tty_ldisc_close.isra.0+0x119/0x190 drivers/tty/tty_ldisc.c:494
  tty_ldisc_kill+0x9c/0x160 drivers/tty/tty_ldisc.c:642
  tty_ldisc_release+0xe9/0x2b0 drivers/tty/tty_ldisc.c:814
  tty_release_struct+0x1b/0x50 drivers/tty/tty_io.c:1612
  tty_release+0xbcb/0xe90 drivers/tty/tty_io.c:1785
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  exit_task_work include/linux/task_work.h:22 [inline]
  do_exit+0x92f/0x2e50 kernel/exit.c:879
  do_group_exit+0x135/0x360 kernel/exit.c:983
  get_signal+0x47c/0x2500 kernel/signal.c:2734
  do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
  exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
  prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
  do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a09
Code: Bad RIP value.
RSP: 002b:00007fe8f55a0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000459a09
RDX: 0000000000000002 RSI: 00000000400455c8 RDI: 0000000000000006
RBP: 000000000075c118 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe8f55a16d4
R13: 00000000004c26f7 R14: 00000000004d5df8 R15: 00000000ffffffff
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 9385 Comm: syz-executor.3 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:__wake_up_common+0xdf/0x610 kernel/sched/wait.c:86
Code: 05 00 00 4c 8b 43 38 49 83 e8 18 49 8d 78 18 48 39 7d d0 0f 84 64 02  
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 <80> 3c 01 00 0f  
85 0b 05 00 00 49 8b 40 18 89 55 b0 31 db 49 bc 00
RSP: 0018:ffff888097617698 EFLAGS: 00010046
RAX: dffffc0000000000 RBX: ffff88809612eb38 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 1ffffffff138dcf6 RDI: 0000000000000000
RBP: ffff8880976176f0 R08: ffffffffffffffe8 R09: 0000000000000000
R10: ffffed1012ec2ece R11: 0000000000000003 R12: ffff88809612eb80
R13: ffff88809612eb30 R14: 0000000000000000 R15: ffff88809612eb38
FS:  00007fe8f55a1700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004599df CR3: 000000008ff2c000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  __wake_up_locked+0x11/0x20 kernel/sched/wait.c:151
  rcu_sync_func+0x16f/0x200 kernel/rcu/sync.c:87
  rcu_sync_enter+0x158/0x310 kernel/rcu/sync.c:150
  percpu_down_write+0x61/0x437 kernel/locking/percpu-rwsem.c:146
  hci_uart_tty_close+0x154/0x280 drivers/bluetooth/hci_ldisc.c:537
  tty_ldisc_close.isra.0+0x119/0x190 drivers/tty/tty_ldisc.c:494
  tty_ldisc_kill+0x9c/0x160 drivers/tty/tty_ldisc.c:642
  tty_ldisc_release+0xe9/0x2b0 drivers/tty/tty_ldisc.c:814
  tty_release_struct+0x1b/0x50 drivers/tty/tty_io.c:1612
  tty_release+0xbcb/0xe90 drivers/tty/tty_io.c:1785
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  exit_task_work include/linux/task_work.h:22 [inline]
  do_exit+0x92f/0x2e50 kernel/exit.c:879
  do_group_exit+0x135/0x360 kernel/exit.c:983
  get_signal+0x47c/0x2500 kernel/signal.c:2734
  do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815
  exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:159
  prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
  do_syscall_64+0x65f/0x760 arch/x86/entry/common.c:300
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a09
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fe8f55a0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000459a09
RDX: 0000000000000002 RSI: 00000000400455c8 RDI: 0000000000000006
RBP: 000000000075c118 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe8f55a16d4
R13: 00000000004c26f7 R14: 00000000004d5df8 R15: 00000000ffffffff
Modules linked in:
---[ end trace cf75381aeb7c112c ]---
RIP: 0010:__wake_up_common+0xdf/0x610 kernel/sched/wait.c:86
Code: 05 00 00 4c 8b 43 38 49 83 e8 18 49 8d 78 18 48 39 7d d0 0f 84 64 02  
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 f9 48 c1 e9 03 <80> 3c 01 00 0f  
85 0b 05 00 00 49 8b 40 18 89 55 b0 31 db 49 bc 00
RSP: 0018:ffff888097617698 EFLAGS: 00010046
RAX: dffffc0000000000 RBX: ffff88809612eb38 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 1ffffffff138dcf6 RDI: 0000000000000000
RBP: ffff8880976176f0 R08: ffffffffffffffe8 R09: 0000000000000000
R10: ffffed1012ec2ece R11: 0000000000000003 R12: ffff88809612eb80
R13: ffff88809612eb30 R14: 0000000000000000 R15: ffff88809612eb38
FS:  00007fe8f55a1700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004599df CR3: 000000008ff2c000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


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

* [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
  2019-09-24 12:09 ` syzbot
@ 2022-08-29 14:58   ` Tetsuo Handa
  2022-08-29 16:08     ` bluez.test.bot
  2022-09-19 17:40     ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 5+ messages in thread
From: Tetsuo Handa @ 2022-08-29 14:58 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Ronald Tschalar, Lukas Wunner
  Cc: syzbot, syzkaller-bugs, linux-bluetooth

syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1],
for rcu_sync_enter() is called without rcu_sync_init() due to
hci_uart_tty_open() ignoring percpu_init_rwsem() failure.

While we are at it, fix that hci_uart_register_device() ignores
percpu_init_rwsem() failure and hci_uart_unregister_device() does not
call percpu_free_rwsem().

Link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f [1]
Reported-by: syzbot <syzbot+576dfca25381fb6fbc5f@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 67d2f8781b9f00d1 ("Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.")
Fixes: d73e172816652772 ("Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops")
---
 drivers/bluetooth/hci_ldisc.c  |  7 +++++--
 drivers/bluetooth/hci_serdev.c | 10 +++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index f537673ede17..865112e96ff9 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -493,6 +493,11 @@ static int hci_uart_tty_open(struct tty_struct *tty)
 		BT_ERR("Can't allocate control structure");
 		return -ENFILE;
 	}
+	if (percpu_init_rwsem(&hu->proto_lock)) {
+		BT_ERR("Can't allocate semaphore structure");
+		kfree(hu);
+		return -ENOMEM;
+	}
 
 	tty->disc_data = hu;
 	hu->tty = tty;
@@ -505,8 +510,6 @@ static int hci_uart_tty_open(struct tty_struct *tty)
 	INIT_WORK(&hu->init_ready, hci_uart_init_work);
 	INIT_WORK(&hu->write_work, hci_uart_write_work);
 
-	percpu_init_rwsem(&hu->proto_lock);
-
 	/* Flush any pending characters in the driver */
 	tty_driver_flush_buffer(tty);
 
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index c0e5f42ec6b7..f16fd79bc02b 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -310,11 +310,12 @@ int hci_uart_register_device(struct hci_uart *hu,
 
 	serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops);
 
+	if (percpu_init_rwsem(&hu->proto_lock))
+		return -ENOMEM;
+
 	err = serdev_device_open(hu->serdev);
 	if (err)
-		return err;
-
-	percpu_init_rwsem(&hu->proto_lock);
+		goto err_rwsem;
 
 	err = p->open(hu);
 	if (err)
@@ -389,6 +390,8 @@ int hci_uart_register_device(struct hci_uart *hu,
 	p->close(hu);
 err_open:
 	serdev_device_close(hu->serdev);
+err_rwsem:
+	percpu_free_rwsem(&hu->proto_lock);
 	return err;
 }
 EXPORT_SYMBOL_GPL(hci_uart_register_device);
@@ -410,5 +413,6 @@ void hci_uart_unregister_device(struct hci_uart *hu)
 		clear_bit(HCI_UART_PROTO_READY, &hu->flags);
 		serdev_device_close(hu->serdev);
 	}
+	percpu_free_rwsem(&hu->proto_lock);
 }
 EXPORT_SYMBOL_GPL(hci_uart_unregister_device);
-- 
2.18.4


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

* RE: Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
  2022-08-29 14:58   ` [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Tetsuo Handa
@ 2022-08-29 16:08     ` bluez.test.bot
  2022-09-19 17:40     ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-08-29 16:08 UTC (permalink / raw)
  To: linux-bluetooth, penguin-kernel

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=672057

---Test result---

Test Summary:
CheckPatch                    PASS      1.50 seconds
GitLint                       PASS      0.78 seconds
SubjectPrefix                 PASS      0.61 seconds
BuildKernel                   PASS      41.89 seconds
BuildKernel32                 PASS      36.63 seconds
Incremental Build with patchesPASS      53.05 seconds
TestRunner: Setup             PASS      605.00 seconds
TestRunner: l2cap-tester      PASS      20.78 seconds
TestRunner: bnep-tester       PASS      8.29 seconds
TestRunner: mgmt-tester       PASS      126.49 seconds
TestRunner: rfcomm-tester     PASS      12.08 seconds
TestRunner: sco-tester        PASS      11.95 seconds
TestRunner: smp-tester        PASS      11.84 seconds
TestRunner: userchan-tester   PASS      8.58 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
  2022-08-29 14:58   ` [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Tetsuo Handa
  2022-08-29 16:08     ` bluez.test.bot
@ 2022-09-19 17:40     ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-09-19 17:40 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: marcel, johan.hedberg, luiz.dentz, ronald, lukas,
	syzbot+576dfca25381fb6fbc5f, syzkaller-bugs, linux-bluetooth

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 29 Aug 2022 23:58:12 +0900 you wrote:
> syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1],
> for rcu_sync_enter() is called without rcu_sync_init() due to
> hci_uart_tty_open() ignoring percpu_init_rwsem() failure.
> 
> While we are at it, fix that hci_uart_register_device() ignores
> percpu_init_rwsem() failure and hci_uart_unregister_device() does not
> call percpu_free_rwsem().
> 
> [...]

Here is the summary with links:
  - Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
    https://git.kernel.org/bluetooth/bluetooth-next/c/3124d320c22f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-09-19 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 19:04 INFO: trying to register non-static key in hci_uart_flush (2) syzbot
2019-09-24 12:09 ` syzbot
2022-08-29 14:58   ` [PATCH] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Tetsuo Handa
2022-08-29 16:08     ` bluez.test.bot
2022-09-19 17:40     ` [PATCH] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.