[syzbot] [media?] [usb?] WARNING in smsusb_start_streaming

18 views
Skip to first unread message

syzbot

unread,
Jul 7, 2023, 11:37:00 AM7/7/23
to duo...@zju.edu.cn, hverkui...@xs4all.nl, linux-...@vger.kernel.org, linux...@vger.kernel.org, linu...@vger.kernel.org, mch...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d528014517f2 Revert ".gitignore: ignore *.cover and *.mbx"
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=10953308a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d576750da57ebbb5
dashboard link: https://syzkaller.appspot.com/bug?extid=a7c205f9c1168e2f1dcc
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=17dd0d94a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ea4fa0a80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/25611d498c84/disk-d5280145.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6cd9d0d55a7a/vmlinux-d5280145.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f0627705b54b/bzImage-d5280145.xz

The issue was bisected to:

commit ebad8e731c1c06adf04621d6fd327b860c0861b5
Author: Duoming Zhou <duo...@zju.edu.cn>
Date: Mon Jan 23 02:04:38 2023 +0000

media: usb: siano: Fix use after free bugs caused by do_submit_urb

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=172533e8a80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=14a533e8a80000
console output: https://syzkaller.appspot.com/x/log.txt?x=10a533e8a80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a7c205...@syzkaller.appspotmail.com
Fixes: ebad8e731c1c ("media: usb: siano: Fix use after free bugs caused by do_submit_urb")

smsusb:smsusb_probe: board id=7, interface number 55
smsusb:smsusb_probe: board id=7, interface number 147
smsusb:smsusb_probe: board id=7, interface number 0
smsusb:siano_media_device_register: media controller created
smsusb:smsusb_start_streaming: smsusb_submit_urb(...) failed
------------[ cut here ]------------
WARNING: CPU: 0 PID: 917 at kernel/workqueue.c:3379 __flush_work+0x946/0xb60 kernel/workqueue.c:3379
Modules linked in:
CPU: 0 PID: 917 Comm: kworker/0:2 Not tainted 6.4.0-syzkaller-11478-gd528014517f2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Workqueue: usb_hub_wq hub_event
RIP: 0010:__flush_work+0x946/0xb60 kernel/workqueue.c:3379
Code: 00 48 c7 c6 2b 36 54 81 48 c7 c7 00 27 9a 8c e8 c0 09 12 00 e9 6f fc ff ff e8 16 a9 30 00 0f 0b e9 63 fc ff ff e8 0a a9 30 00 <0f> 0b 45 31 ed e9 54 fc ff ff e8 6b d8 83 00 e9 3e fb ff ff e8 f1
RSP: 0018:ffffc900050aebf0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888071a480e8 RCX: 0000000000000000
RDX: ffff88801fc05940 RSI: ffffffff81543666 RDI: 0000000000000001
RBP: ffffc900050aed88 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 1ffffffff21ed137 R12: ffff888071a480e8
R13: 0000000000000001 R14: 0000000000000001 R15: ffff888071a48100
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000564a82410ac8 CR3: 000000002c52c000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__cancel_work_timer+0x3f9/0x570 kernel/workqueue.c:3473
smsusb_stop_streaming drivers/media/usb/siano/smsusb.c:182 [inline]
smsusb_start_streaming+0x33c/0x650 drivers/media/usb/siano/smsusb.c:199
smsusb_init_device+0x7f7/0xd20 drivers/media/usb/siano/smsusb.c:476
smsusb_probe+0x5b9/0x10b0 drivers/media/usb/siano/smsusb.c:567
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:798
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828
__device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:956
bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1028
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:798
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828
__device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:956
bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1028
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:2590
hub_port_connect drivers/usb/core/hub.c:5422 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5566 [inline]
port_event drivers/usb/core/hub.c:5726 [inline]
hub_event+0x2d9e/0x4e40 drivers/usb/core/hub.c:5808
process_one_work+0xa34/0x16f0 kernel/workqueue.c:2597
worker_thread+0x67d/0x10c0 kernel/workqueue.c:2748
kthread+0x344/0x440 kernel/kthread.c:389
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 syzk...@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 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

Hillf Danton

unread,
Jul 7, 2023, 9:54:34 PM7/7/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Fri, 07 Jul 2023 08:36:59 -0700
> syzbot found the following issue on:
>
> HEAD commit: d528014517f2 Revert ".gitignore: ignore *.cover and *.mbx"
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ea4fa0a80000

Try to avoid canceling un-init work.

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

--- x/drivers/media/usb/siano/smsusb.c
+++ y/drivers/media/usb/siano/smsusb.c
@@ -173,11 +173,11 @@ static int smsusb_submit_urb(struct smsu
return usb_submit_urb(&surb->urb, GFP_ATOMIC);
}

-static void smsusb_stop_streaming(struct smsusb_device_t *dev)
+static void __smsusb_stop_streaming(struct smsusb_device_t *dev, int nr)
{
int i;

- for (i = 0; i < MAX_URBS; i++) {
+ for (i = 0; i < nr; i++) {
usb_kill_urb(&dev->surbs[i].urb);
cancel_work_sync(&dev->surbs[i].wq);

@@ -188,6 +188,11 @@ static void smsusb_stop_streaming(struct
}
}

+static void smsusb_stop_streaming(struct smsusb_device_t *dev)
+{
+ __smsusb_stop_streaming(dev, MAX_URBS);
+}
+
static int smsusb_start_streaming(struct smsusb_device_t *dev)
{
int i, rc;
@@ -196,7 +201,7 @@ static int smsusb_start_streaming(struct
rc = smsusb_submit_urb(dev, &dev->surbs[i]);
if (rc < 0) {
pr_err("smsusb_submit_urb(...) failed\n");
- smsusb_stop_streaming(dev);
+ __smsusb_stop_streaming(dev, i);
break;
}
}
--

syzbot

unread,
Jul 7, 2023, 10:08:22 PM7/7/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in smsusb_term_device

smsusb:smsusb_probe: board id=7, interface number 55
smsusb:smsusb_probe: board id=7, interface number 147
smsusb:smsusb_probe: board id=7, interface number 0
smsusb:siano_media_device_register: media controller created
smsusb:smsusb_start_streaming: smsusb_submit_urb(...) failed
smsusb:smsusb_init_device: smsusb_start_streaming(...) failed
------------[ cut here ]------------
WARNING: CPU: 0 PID: 2029 at kernel/workqueue.c:3379 __flush_work+0x946/0xb60 kernel/workqueue.c:3379
Modules linked in:
CPU: 0 PID: 2029 Comm: kworker/0:3 Not tainted 6.4.0-syzkaller-11478-gd528014517f2-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Workqueue: usb_hub_wq hub_event
RIP: 0010:__flush_work+0x946/0xb60 kernel/workqueue.c:3379
Code: 00 48 c7 c6 2b 36 54 81 48 c7 c7 00 27 9a 8c e8 c0 09 12 00 e9 6f fc ff ff e8 16 a9 30 00 0f 0b e9 63 fc ff ff e8 0a a9 30 00 <0f> 0b 45 31 ed e9 54 fc ff ff e8 6b d8 83 00 e9 3e fb ff ff e8 f1
RSP: 0018:ffffc9000797ec08 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88801b5d20e8 RCX: 0000000000000000
RDX: ffff888024503b80 RSI: ffffffff81543666 RDI: 0000000000000001
RBP: ffffc9000797eda0 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000005 R12: ffff88801b5d20e8
R13: 0000000000000001 R14: 0000000000000001 R15: ffff88801b5d2100
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff765634a8 CR3: 0000000018f20000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__cancel_work_timer+0x3f9/0x570 kernel/workqueue.c:3473
__smsusb_stop_streaming drivers/media/usb/siano/smsusb.c:182 [inline]
smsusb_stop_streaming drivers/media/usb/siano/smsusb.c:193 [inline]
smsusb_term_device+0xee/0x300 drivers/media/usb/siano/smsusb.c:349
smsusb_init_device+0xadc/0xd20 drivers/media/usb/siano/smsusb.c:484
smsusb_probe+0x5b9/0x10b0 drivers/media/usb/siano/smsusb.c:572
Tested on:

commit: d5280145 Revert ".gitignore: ignore *.cover and *.mbx"
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1769c3aca80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d576750da57ebbb5
dashboard link: https://syzkaller.appspot.com/bug?extid=a7c205f9c1168e2f1dcc
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=169e9ca8a80000

Hillf Danton

unread,
Jul 8, 2023, 12:05:19 AM7/8/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Fri, 07 Jul 2023 08:36:59 -0700
> syzbot found the following issue on:
>
> HEAD commit: d528014517f2 Revert ".gitignore: ignore *.cover and *.mbx"
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ea4fa0a80000

Try to avoid canceling un-init work.

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

--- x/drivers/media/usb/siano/smsusb.c
+++ y/drivers/media/usb/siano/smsusb.c
@@ -470,6 +470,7 @@ static int smsusb_init_device(struct usb
for (i = 0; i < MAX_URBS; i++) {
dev->surbs[i].dev = dev;
usb_init_urb(&dev->surbs[i].urb);
+ INIT_WORK(&dev->surbs[i].wq, do_submit_urb);
}

pr_debug("smsusb_start_streaming(...).\n");
--

syzbot

unread,
Jul 8, 2023, 12:41:39 AM7/8/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

Reported-and-tested-by: syzbot+a7c205...@syzkaller.appspotmail.com

Tested on:

commit: d5280145 Revert ".gitignore: ignore *.cover and *.mbx"
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=14150e3ca80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d576750da57ebbb5
dashboard link: https://syzkaller.appspot.com/bug?extid=a7c205f9c1168e2f1dcc
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=127c479ca80000

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

syzbot

unread,
Aug 11, 2023, 9:11:32 AM8/11/23
to duo...@zju.edu.cn, hda...@sina.com, hverkui...@xs4all.nl, linux-...@vger.kernel.org, linux...@vger.kernel.org, linu...@vger.kernel.org, mch...@kernel.org, syzkall...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit 6f489a966fbeb0da63d45c2c66a8957eab604bf6
Author: Duoming Zhou <duo...@zju.edu.cn>
Date: Mon May 22 23:59:32 2023 +0000

media: usb: siano: Fix warning due to null work_func_t function pointer

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=122f7a3ba80000
start commit: d528014517f2 Revert ".gitignore: ignore *.cover and *.mbx"
git tree: upstream
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: media: usb: siano: Fix warning due to null work_func_t function pointer

syzbot

unread,
Oct 15, 2023, 12:00:50 PM10/15/23
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages