WARNING in imon_probe
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: fd37b884003c io_uring/io-wq: don't clear PF_IO_WORKER on e.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=13f67407280000 kernel config: https://syzkaller.appspot.com/x/.config?x=5bcee04c3b2a8237 dashboard link: https://syzkaller.appspot.com/bug?extid=1c41b2e045dc086f58be compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1339b027280000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7108f22d99d8/disk-fd37b884.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/83e4f595c21b/vmlinux-fd37b884.xz
kernel image: https://storage.googleapis.com/syzbot-assets/16c5c6a2de66/bzImage-fd37b884.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
usb 1-1: 2:1 : UAC_AS_GENERAL descriptor not found
------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(lock->magic != lock) WARNING: CPU: 1 PID: 4606 at kernel/locking/mutex.c:582 __mutex_lock_common kernel/locking/mutex.c:582 [inline] WARNING: CPU: 1 PID: 4606 at kernel/locking/mutex.c:582 __mutex_lock+0x9f8/0x1350 kernel/locking/mutex.c:747 Modules linked in: CPU: 1 PID: 4606 Comm: kworker/1:3 Not tainted 6.4.0-rc6-syzkaller-00006-gfd37b884003c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Workqueue: usb_hub_wq hub_event RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:582 [inline] RIP: 0010:__mutex_lock+0x9f8/0x1350 kernel/locking/mutex.c:747 Code: 08 84 d2 0f 85 7e 08 00 00 8b 05 5f a8 67 04 85 c0 0f 85 1b f7 ff ff 48 c7 c6 80 59 4c 8a 48 c7 c7 40 57 4c 8a e8 08 ee 38 f7 <0f> 0b e9 01 f7 ff ff 48 8b 7c 24 30 be 08 00 00 00 e8 e2 02 c4 f7 RSP: 0018:ffffc9000346efb0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888025839dc0 RSI: ffffffff814c03b7 RDI: 0000000000000001 RBP: ffff88807bc74ea8 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff888020037000 R15: ffff88807bc750d1 FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc66ff2f38 CR3: 0000000023c93000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> imon_init_intf1 drivers/media/rc/imon.c:2321 [inline] imon_probe+0x1e5/0x3630 drivers/media/rc/imon.c:2449 usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x240/0xca0 drivers/base/dd.c:658 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x112d/0x1a40 drivers/base/core.c:3625 usb_set_configuration+0x1196/0x1bc0 drivers/usb/core/message.c:2211 usb_generic_driver_probe+0xcf/0x130 drivers/usb/core/generic.c:238 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x240/0xca0 drivers/base/dd.c:658 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x112d/0x1a40 drivers/base/core.c:3625 usb_new_device+0xcb2/0x19d0 drivers/usb/core/hub.c:2575 hub_port_connect drivers/usb/core/hub.c:5407 [inline] hub_port_connect_change drivers/usb/core/hub.c:5551 [inline] port_event drivers/usb/core/hub.c:5711 [inline] hub_event+0x2d9e/0x4e40 drivers/usb/core/hub.c:5793 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 </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 [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the bug is already fixed, 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 change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
Quoted 2 lines
If you want syzbot to run the reproducer, reply with:
#syz test:git://repo/address.gitbranch-or-commit-hash
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a48fa7efaf1161c1c898931fe4c7f0070964233a
drivers/media/rc/imon.c +6 -0
@@ -2427,6 +2427,12 @@ static int imon_probe(struct usb_interface *interface, goto fail; } +if (first_if->dev.driver != interface->dev.driver) { +dev_err (&interface->dev,"inconsistent driver matching\n" ); + ret = -EINVAL ; + goto fail; + } +if (ifnum ==0 ) { ictx =imon_init_intf0 (interface, id);if (!ictx) {
syzbot
syzbotsyzbot tried to test the proposed patch but the build/boot failed:
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
failed to apply patch:
checking file drivers/media/rc/imon.c
patch: **** unexpected end of file in patch
Tested on:
commit: a48fa7ef Merge tag 'drm-next-2023-09-08' of git://anon.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel config: https://syzkaller.appspot.com/x/.config?x=150188feee7071a7 dashboard link: https://syzkaller.appspot.com/bug?extid=1c41b2e045dc086f58be
compiler:
patch: https://syzkaller.appspot.com/x/patch.diff?x=17cadccc680000
Ricardo B. Marliere
Tested-by#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a48fa7efaf1161c1c898931fe4c7f0070964233a
From de69b3143facb3280f144fe88e1a7e6dfae9f97e Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Fri, 22 Sep 2023 14:38:07 +0200
Subject: [PATCH] media: imon: fix access to invalid resource for the second
interface
imon driver probes two USB interfaces, and at the probe of the second interface, the driver assumes blindly that the first interface got bound with the same imon driver. It's usually true, but it's still possible that the first interface is bound with another driver via a malformed descriptor. Then it may lead to a memory corruption, as spotted by syzkaller; imon driver accesses the data from drvdata as struct imon_context object although it's a completely different one that was assigned by another driver.
This patch adds a sanity check -- whether the first interface is really bound with the imon driver or not -- for avoiding the problem above at the probe time.
--- drivers/media/rc/imon.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/rc/imon.c +6 -0
@@ -2427,6 +2427,12 @@ static int imon_probe(struct usb_interface *interface, goto fail; } +if (first_if->dev.driver != interface->dev.driver) { +dev_err (&interface->dev,"inconsistent driver matching\n" ); + ret = -EINVAL ; + goto fail; + } +if (ifnum ==0 ) { ictx =imon_init_intf0 (interface, id);if (!ictx) {
Signature · 1 line
2.40.1
syzbot
syzbotsyzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: a48fa7ef Merge tag 'drm-next-2023-09-08' of git://anon.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git console output: https://syzkaller.appspot.com/x/log.txt?x=13257bd4680000 kernel config: https://syzkaller.appspot.com/x/.config?x=8dfc2c52f63929e dashboard link: https://syzkaller.appspot.com/bug?extid=1c41b2e045dc086f58be compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=17ca18da680000
Note: testing is done by a robot and is best-effort only.
#syz dup: KASAN: slab-out-of-bounds Read in imon_probe