public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [media?] WARNING in uvc_status_unregister
@ 2024-10-20  6:44 syzbot
  2024-10-20  8:06 ` Hillf Danton
  2024-10-20 16:02 ` Laurent Pinchart
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-10-20  6:44 UTC (permalink / raw)
  To: hverkuil-cisco, laurent.pinchart, linux-kernel, linux-media,
	mchehab, ribalda, senozhatsky, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    15e7d45e786a Add linux-next specific files for 20241016
git tree:       linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=14a8f887980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c36416f1c54640c0
dashboard link: https://syzkaller.appspot.com/bug?extid=9446d5e0d25571e6a212
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1483e830580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10560240580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/cf2ad43c81cc/disk-15e7d45e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c85347a66a1c/vmlinux-15e7d45e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/648cf8e59c13/bzImage-15e7d45e.xz

The issue was bisected to:

commit c5fe3ed618f995b4a903e574bf2e993cdebeefca
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Thu Sep 26 05:49:58 2024 +0000

    media: uvcvideo: Avoid race condition during unregister

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12554240580000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=11554240580000
console output: https://syzkaller.appspot.com/x/log.txt?x=16554240580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9446d5e0d25571e6a212@syzkaller.appspotmail.com
Fixes: c5fe3ed618f9 ("media: uvcvideo: Avoid race condition during unregister")

usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: syz
usb 1-1: Manufacturer: syz
usb 1-1: SerialNumber: syz
usb 1-1: config 0 descriptor??
usb 1-1: Found UVC 0.00 device syz (05ac:8600)
usb 1-1: No valid video chain found.
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 0 PID: 1166 at kernel/locking/mutex.c:587 __mutex_lock_common kernel/locking/mutex.c:587 [inline]
WARNING: CPU: 0 PID: 1166 at kernel/locking/mutex.c:587 __mutex_lock+0xc41/0xd70 kernel/locking/mutex.c:752
Modules linked in:
CPU: 0 UID: 0 PID: 1166 Comm: kworker/0:2 Not tainted 6.12.0-rc3-next-20241016-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: usb_hub_wq hub_event
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:587 [inline]
RIP: 0010:__mutex_lock+0xc41/0xd70 kernel/locking/mutex.c:752
Code: 0f b6 04 20 84 c0 0f 85 18 01 00 00 83 3d 36 20 49 04 00 75 19 90 48 c7 c7 20 b9 0a 8c 48 c7 c6 c0 b9 0a 8c e8 00 0f 81 f5 90 <0f> 0b 90 90 90 e9 bd f4 ff ff 90 0f 0b 90 e9 cf f8 ff ff 90 0f 0b
RSP: 0018:ffffc90004516980 EFLAGS: 00010246
RAX: 44423ff48d37de00 RBX: 0000000000000000 RCX: ffff888027929e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90004516ad0 R08: ffffffff8155d7b2 R09: fffffbfff1cfa3e0
R10: dffffc0000000000 R11: fffffbfff1cfa3e0 R12: dffffc0000000000
R13: ffff88814bd82518 R14: 0000000000000000 R15: ffff88814bd824e8
FS:  0000000000000000(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055ffca8e3610 CR3: 000000001e3f4000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 class_mutex_constructor include/linux/mutex.h:201 [inline]
 uvc_status_suspend drivers/media/usb/uvc/uvc_status.c:375 [inline]
 uvc_status_unregister+0x2f/0xe0 drivers/media/usb/uvc/uvc_status.c:297
 uvc_unregister_video+0xeb/0x1c0 drivers/media/usb/uvc/uvc_driver.c:1947
 uvc_probe+0x9135/0x98c0 drivers/media/usb/uvc/uvc_driver.c:2272
 usb_probe_interface+0x645/0xbb0 drivers/usb/core/driver.c:399
 really_probe+0x2b8/0xad0 drivers/base/dd.c:658
 __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
 driver_probe_device+0x50/0x430 drivers/base/dd.c:830
 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
 bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:459
 __device_attach+0x333/0x520 drivers/base/dd.c:1030
 bus_probe_device+0x189/0x260 drivers/base/bus.c:534
 device_add+0x856/0xbf0 drivers/base/core.c:3675
 usb_set_configuration+0x1976/0x1fb0 drivers/usb/core/message.c:2210
 usb_generic_driver_probe+0x88/0x140 drivers/usb/core/generic.c:254
 usb_probe_device+0x1b8/0x380 drivers/usb/core/driver.c:294
 really_probe+0x2b8/0xad0 drivers/base/dd.c:658
 __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
 driver_probe_device+0x50/0x430 drivers/base/dd.c:830
 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
 bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:459
 __device_attach+0x333/0x520 drivers/base/dd.c:1030
 bus_probe_device+0x189/0x260 drivers/base/bus.c:534
 device_add+0x856/0xbf0 drivers/base/core.c:3675
 usb_new_device+0x104a/0x19a0 drivers/usb/core/hub.c:2651
 hub_port_connect drivers/usb/core/hub.c:5521 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5661 [inline]
 port_event drivers/usb/core/hub.c:5821 [inline]
 hub_event+0x2d6d/0x5150 drivers/usb/core/hub.c:5903
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

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

* Re: [syzbot] [media?] WARNING in uvc_status_unregister
  2024-10-20  6:44 [syzbot] [media?] WARNING in uvc_status_unregister syzbot
@ 2024-10-20  8:06 ` Hillf Danton
  2024-10-20  9:16   ` syzbot
  2024-10-20 16:02 ` Laurent Pinchart
  1 sibling, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2024-10-20  8:06 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

On Sat, 19 Oct 2024 23:44:28 -0700
> syzbot found the following issue on:
> 
> HEAD commit:    15e7d45e786a Add linux-next specific files for 20241016
> git tree:       linux-next
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10560240580000

#syz test

--- x/drivers/media/usb/uvc/uvc_status.c
+++ y/drivers/media/usb/uvc/uvc_status.c
@@ -372,6 +372,8 @@ int uvc_status_resume(struct uvc_device
 
 void uvc_status_suspend(struct uvc_device *dev)
 {
+	if (!dev->int_urb)
+		return;
 	guard(mutex)(&dev->status_lock);
 
 	if (dev->status_users)
--

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

* Re: [syzbot] [media?] WARNING in uvc_status_unregister
  2024-10-20  8:06 ` Hillf Danton
@ 2024-10-20  9:16   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-10-20  9:16 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+9446d5e0d25571e6a212@syzkaller.appspotmail.com
Tested-by: syzbot+9446d5e0d25571e6a212@syzkaller.appspotmail.com

Tested on:

commit:         f2493655 Add linux-next specific files for 20241018
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11a88c87980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=838d70a59aaad5d2
dashboard link: https://syzkaller.appspot.com/bug?extid=9446d5e0d25571e6a212
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=12b320a7980000

Note: testing is done by a robot and is best-effort only.

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

* Re: [syzbot] [media?] WARNING in uvc_status_unregister
  2024-10-20  6:44 [syzbot] [media?] WARNING in uvc_status_unregister syzbot
  2024-10-20  8:06 ` Hillf Danton
@ 2024-10-20 16:02 ` Laurent Pinchart
  2024-10-22  8:41   ` Ricardo Ribalda
  1 sibling, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2024-10-20 16:02 UTC (permalink / raw)
  To: syzbot
  Cc: hverkuil-cisco, linux-kernel, linux-media, mchehab, ribalda,
	senozhatsky, syzkaller-bugs

On Sat, Oct 19, 2024 at 11:44:28PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    15e7d45e786a Add linux-next specific files for 20241016
> git tree:       linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=14a8f887980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=c36416f1c54640c0
> dashboard link: https://syzkaller.appspot.com/bug?extid=9446d5e0d25571e6a212
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1483e830580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10560240580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/cf2ad43c81cc/disk-15e7d45e.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/c85347a66a1c/vmlinux-15e7d45e.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/648cf8e59c13/bzImage-15e7d45e.xz
> 
> The issue was bisected to:
> 
> commit c5fe3ed618f995b4a903e574bf2e993cdebeefca
> Author: Ricardo Ribalda <ribalda@chromium.org>
> Date:   Thu Sep 26 05:49:58 2024 +0000
> 
>     media: uvcvideo: Avoid race condition during unregister

It looks like the issue comes from the fact that uvc_status_unregister()
gets called from the error path in uvc_probe() through
uvc_unregister_video(), likely for errors occuring before
uvc_status_init() is called. uvc_status_unregister() should return
immediately in that case. Ricardo, do you plan to look at that?

> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12554240580000
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=11554240580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=16554240580000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+9446d5e0d25571e6a212@syzkaller.appspotmail.com
> Fixes: c5fe3ed618f9 ("media: uvcvideo: Avoid race condition during unregister")
> 
> usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> usb 1-1: Product: syz
> usb 1-1: Manufacturer: syz
> usb 1-1: SerialNumber: syz
> usb 1-1: config 0 descriptor??
> usb 1-1: Found UVC 0.00 device syz (05ac:8600)
> usb 1-1: No valid video chain found.
> ------------[ cut here ]------------
> DEBUG_LOCKS_WARN_ON(lock->magic != lock)
> WARNING: CPU: 0 PID: 1166 at kernel/locking/mutex.c:587 __mutex_lock_common kernel/locking/mutex.c:587 [inline]
> WARNING: CPU: 0 PID: 1166 at kernel/locking/mutex.c:587 __mutex_lock+0xc41/0xd70 kernel/locking/mutex.c:752
> Modules linked in:
> CPU: 0 UID: 0 PID: 1166 Comm: kworker/0:2 Not tainted 6.12.0-rc3-next-20241016-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
> Workqueue: usb_hub_wq hub_event
> RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:587 [inline]
> RIP: 0010:__mutex_lock+0xc41/0xd70 kernel/locking/mutex.c:752
> Code: 0f b6 04 20 84 c0 0f 85 18 01 00 00 83 3d 36 20 49 04 00 75 19 90 48 c7 c7 20 b9 0a 8c 48 c7 c6 c0 b9 0a 8c e8 00 0f 81 f5 90 <0f> 0b 90 90 90 e9 bd f4 ff ff 90 0f 0b 90 e9 cf f8 ff ff 90 0f 0b
> RSP: 0018:ffffc90004516980 EFLAGS: 00010246
> RAX: 44423ff48d37de00 RBX: 0000000000000000 RCX: ffff888027929e00
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
> RBP: ffffc90004516ad0 R08: ffffffff8155d7b2 R09: fffffbfff1cfa3e0
> R10: dffffc0000000000 R11: fffffbfff1cfa3e0 R12: dffffc0000000000
> R13: ffff88814bd82518 R14: 0000000000000000 R15: ffff88814bd824e8
> FS:  0000000000000000(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 000055ffca8e3610 CR3: 000000001e3f4000 CR4: 00000000003526f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  <TASK>
>  class_mutex_constructor include/linux/mutex.h:201 [inline]
>  uvc_status_suspend drivers/media/usb/uvc/uvc_status.c:375 [inline]
>  uvc_status_unregister+0x2f/0xe0 drivers/media/usb/uvc/uvc_status.c:297
>  uvc_unregister_video+0xeb/0x1c0 drivers/media/usb/uvc/uvc_driver.c:1947
>  uvc_probe+0x9135/0x98c0 drivers/media/usb/uvc/uvc_driver.c:2272
>  usb_probe_interface+0x645/0xbb0 drivers/usb/core/driver.c:399
>  really_probe+0x2b8/0xad0 drivers/base/dd.c:658
>  __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
>  driver_probe_device+0x50/0x430 drivers/base/dd.c:830
>  __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
>  bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:459
>  __device_attach+0x333/0x520 drivers/base/dd.c:1030
>  bus_probe_device+0x189/0x260 drivers/base/bus.c:534
>  device_add+0x856/0xbf0 drivers/base/core.c:3675
>  usb_set_configuration+0x1976/0x1fb0 drivers/usb/core/message.c:2210
>  usb_generic_driver_probe+0x88/0x140 drivers/usb/core/generic.c:254
>  usb_probe_device+0x1b8/0x380 drivers/usb/core/driver.c:294
>  really_probe+0x2b8/0xad0 drivers/base/dd.c:658
>  __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
>  driver_probe_device+0x50/0x430 drivers/base/dd.c:830
>  __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
>  bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:459
>  __device_attach+0x333/0x520 drivers/base/dd.c:1030
>  bus_probe_device+0x189/0x260 drivers/base/bus.c:534
>  device_add+0x856/0xbf0 drivers/base/core.c:3675
>  usb_new_device+0x104a/0x19a0 drivers/usb/core/hub.c:2651
>  hub_port_connect drivers/usb/core/hub.c:5521 [inline]
>  hub_port_connect_change drivers/usb/core/hub.c:5661 [inline]
>  port_event drivers/usb/core/hub.c:5821 [inline]
>  hub_event+0x2d6d/0x5150 drivers/usb/core/hub.c:5903
>  process_one_work kernel/workqueue.c:3229 [inline]
>  process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
>  worker_thread+0x870/0xd30 kernel/workqueue.c:3391
>  kthread+0x2f0/0x390 kernel/kthread.c:389
>  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> 
> 
> ---
> This report 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 issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
> 
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
> 
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.
> 
> If you want to overwrite report's subsystems, reply with:
> #syz set subsystems: new-subsystem
> (See the list of subsystem names on the web dashboard)
> 
> If the report is a duplicate of another one, reply with:
> #syz dup: exact-subject-of-another-report
> 
> If you want to undo deduplication, reply with:
> #syz undup

-- 
Regards,

Laurent Pinchart

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

* Re: [syzbot] [media?] WARNING in uvc_status_unregister
  2024-10-20 16:02 ` Laurent Pinchart
@ 2024-10-22  8:41   ` Ricardo Ribalda
  0 siblings, 0 replies; 5+ messages in thread
From: Ricardo Ribalda @ 2024-10-22  8:41 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: syzbot, hverkuil-cisco, linux-kernel, linux-media, mchehab,
	senozhatsky, syzkaller-bugs

Hi Laurent

On Sun, 20 Oct 2024 at 18:03, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:

> >     media: uvcvideo: Avoid race condition during unregister
>
> It looks like the issue comes from the fact that uvc_status_unregister()
> gets called from the error path in uvc_probe() through
> uvc_unregister_video(), likely for errors occuring before
> uvc_status_init() is called. uvc_status_unregister() should return
> immediately in that case. Ricardo, do you plan to look at that?
>
Just sent  https://lore.kernel.org/linux-media/20241022-race-unreg-v1-1-2212f364d9de@chromium.org/T/#u
to fix this issue

We probably want to queue:
https://lore.kernel.org/linux-media/20241022-order_status-v1-1-3904fafca340@chromium.org/T/#u
at the same time

But I am not sure if I should also mark the second patch as Fixes

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

end of thread, other threads:[~2024-10-22  8:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20  6:44 [syzbot] [media?] WARNING in uvc_status_unregister syzbot
2024-10-20  8:06 ` Hillf Danton
2024-10-20  9:16   ` syzbot
2024-10-20 16:02 ` Laurent Pinchart
2024-10-22  8:41   ` Ricardo Ribalda

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