* [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init @ 2022-04-14 18:47 syzbot 2022-04-14 20:04 ` Pavel Skripkin 0 siblings, 1 reply; 5+ messages in thread From: syzbot @ 2022-04-14 18:47 UTC (permalink / raw) To: isely, linux-kernel, linux-media, mchehab, syzkaller-bugs Hello, syzbot found the following issue on: HEAD commit: 4ea3c6425269 Merge tag 'powerpc-5.18-2' of git://git.kerne.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=148cb824f00000 kernel config: https://syzkaller.appspot.com/x/.config?x=307baecfd5e87ced dashboard link: https://syzkaller.appspot.com/bug?extid=1a247e36149ffd709a9b 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=17279a70f00000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=121dc124f00000 Bisection is inconclusive: the issue happens on the oldest tested release. bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=142753df700000 final oops: https://syzkaller.appspot.com/x/report.txt?x=162753df700000 console output: https://syzkaller.appspot.com/x/log.txt?x=122753df700000 IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+1a247e36149ffd709a9b@syzkaller.appspotmail.com pvrusb2: You need to resolve the failing condition before this driver can function. There should be some earlier messages giving more information about the problem. pvrusb2: Invalid write control endpoint ================================================================================ UBSAN: array-index-out-of-bounds in drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c:602:13 index -1 is out of range for type 'int [20]' CPU: 0 PID: 1959 Comm: pvrusb2-context Not tainted 5.18.0-rc1-syzkaller-00401-g4ea3c6425269 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 ubsan_epilogue+0xb/0x50 lib/ubsan.c:151 __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:283 pvr2_i2c_core_init+0xc7d/0xd30 drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c:602 pvr2_hdw_setup_low drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2134 [inline] pvr2_hdw_setup drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2261 [inline] pvr2_hdw_initialize+0x787/0x37d0 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2338 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:109 [inline] pvr2_context_thread_func+0x250/0x850 drivers/media/usb/pvrusb2/pvrusb2-context.c:158 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 </TASK> ================================================================================ Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 1959 Comm: pvrusb2-context Not tainted 5.18.0-rc1-syzkaller-00401-g4ea3c6425269 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 panic+0x2d7/0x636 kernel/panic.c:250 ubsan_epilogue+0x4a/0x50 lib/ubsan.c:158 __ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:283 pvr2_i2c_core_init+0xc7d/0xd30 drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c:602 pvr2_hdw_setup_low drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2134 [inline] pvr2_hdw_setup drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2261 [inline] pvr2_hdw_initialize+0x787/0x37d0 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2338 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:109 [inline] pvr2_context_thread_func+0x250/0x850 drivers/media/usb/pvrusb2/pvrusb2-context.c:158 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 </TASK> Kernel Offset: disabled Rebooting in 86400 seconds.. --- 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 syzbot can test patches for this issue, for details see: https://goo.gl/tpsmEJ#testing-patches ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init 2022-04-14 18:47 [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init syzbot @ 2022-04-14 20:04 ` Pavel Skripkin 2022-04-14 20:14 ` syzbot 0 siblings, 1 reply; 5+ messages in thread From: Pavel Skripkin @ 2022-04-14 20:04 UTC (permalink / raw) To: syzbot, isely, linux-kernel, linux-media, mchehab, syzkaller-bugs [-- Attachment #1.1.1: Type: text/plain, Size: 1250 bytes --] Hi Syzbot, On 4/14/22 21:47, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: 4ea3c6425269 Merge tag 'powerpc-5.18-2' of git://git.kerne.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=148cb824f00000 > kernel config: https://syzkaller.appspot.com/x/.config?x=307baecfd5e87ced > dashboard link: https://syzkaller.appspot.com/bug?extid=1a247e36149ffd709a9b > 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=17279a70f00000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=121dc124f00000 > > Bisection is inconclusive: the issue happens on the oldest tested release. > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=142753df700000 > final oops: https://syzkaller.appspot.com/x/report.txt?x=162753df700000 > console output: https://syzkaller.appspot.com/x/log.txt?x=122753df700000 > > IMPORTANT: if you fix the issue, please add the following tag to the commit: just guessing #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master With regards, Pavel Skripkin [-- Attachment #1.1.2: ph --] [-- Type: text/plain, Size: 504 bytes --] diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index cd7b118d5929..2a1a0a0ca225 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2569,6 +2569,9 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, } while (0); mutex_unlock(&pvr2_unit_mtx); + if (hdw->unit_number == -1) + goto fail; + cnt1 = 0; cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); cnt1 += cnt2; [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init 2022-04-14 20:04 ` Pavel Skripkin @ 2022-04-14 20:14 ` syzbot 2022-04-14 20:18 ` Pavel Skripkin 0 siblings, 1 reply; 5+ messages in thread From: syzbot @ 2022-04-14 20:14 UTC (permalink / raw) To: isely, linux-kernel, linux-media, mchehab, paskripkin, syzkaller-bugs Hello, syzbot has tested the proposed patch but the reproducer is still triggering an issue: WARNING in pvr2_hdw_create pvrusb2: Hardware description: OnAir USB2 Hybrid USB tuner ------------[ cut here ]------------ WARNING: CPU: 1 PID: 3607 at kernel/workqueue.c:3066 __flush_work+0x926/0xb10 kernel/workqueue.c:3066 Modules linked in: CPU: 1 PID: 3607 Comm: kworker/1:4 Not tainted 5.18.0-rc2-syzkaller-00187-g115acbb56978-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event RIP: 0010:__flush_work+0x926/0xb10 kernel/workqueue.c:3066 Code: ff 41 89 c4 89 8d 88 fe ff ff e8 d5 2b 77 00 48 0f ba 2b 03 e9 6a fa ff ff e8 c6 8f 2b 00 0f 0b e9 5a fc ff ff e8 ba 8f 2b 00 <0f> 0b 45 31 f6 e9 4b fc ff ff e8 eb 28 77 00 e9 3a fb ff ff e8 a1 RSP: 0018:ffffc90003d1ee00 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff88806e4040d0 RCX: 0000000000000000 RDX: ffff88801e1eba00 RSI: ffffffff814d8be6 RDI: 0000000000000003 RBP: ffffc90003d1ef98 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff814d8365 R11: 0000000000000000 R12: dffffc0000000000 R13: ffff88806e405678 R14: 0000000000000001 R15: ffff88806e4040e8 FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd4ad80638 CR3: 000000002067b000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> pvr2_hdw_create+0x11da/0x2630 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2612 pvr2_context_create+0x1ae/0x280 drivers/media/usb/pvrusb2/pvrusb2-context.c:222 pvr_probe+0x21/0xc0 drivers/media/usb/pvrusb2/pvrusb2-main.c:62 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:542 [inline] really_probe+0x23e/0xb20 drivers/base/dd.c:621 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xb83/0x1e20 drivers/base/core.c:3405 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:542 [inline] really_probe+0x23e/0xb20 drivers/base/dd.c:621 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xb83/0x1e20 drivers/base/core.c:3405 usb_new_device.cold+0x641/0x1091 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5363 [inline] hub_port_connect_change drivers/usb/core/hub.c:5507 [inline] port_event drivers/usb/core/hub.c:5665 [inline] hub_event+0x25c6/0x4680 drivers/usb/core/hub.c:5747 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x854/0x1080 kernel/workqueue.c:2438 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 </TASK> Tested on: commit: 115acbb5 Merge tag 's390-5.18-3' of git://git.kernel.o.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=12ef7197700000 kernel config: https://syzkaller.appspot.com/x/.config?x=eb177500e563582f dashboard link: https://syzkaller.appspot.com/bug?extid=1a247e36149ffd709a9b 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=14838637700000 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init 2022-04-14 20:14 ` syzbot @ 2022-04-14 20:18 ` Pavel Skripkin 2022-04-14 23:31 ` syzbot 0 siblings, 1 reply; 5+ messages in thread From: Pavel Skripkin @ 2022-04-14 20:18 UTC (permalink / raw) To: syzbot, isely, linux-kernel, linux-media, mchehab, syzkaller-bugs [-- Attachment #1.1.1: Type: text/plain, Size: 1167 bytes --] On 4/14/22 23:14, syzbot wrote: > Hello, > > syzbot has tested the proposed patch but the reproducer is still triggering an issue: > WARNING in pvr2_hdw_create > > pvrusb2: Hardware description: OnAir USB2 Hybrid USB tuner > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 3607 at kernel/workqueue.c:3066 __flush_work+0x926/0xb10 kernel/workqueue.c:3066 > Modules linked in: > CPU: 1 PID: 3607 Comm: kworker/1:4 Not tainted 5.18.0-rc2-syzkaller-00187-g115acbb56978-dirty #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > Workqueue: usb_hub_wq hub_event > RIP: 0010:__flush_work+0x926/0xb10 kernel/workqueue.c:3066 > Code: ff 41 89 c4 89 8d 88 fe ff ff e8 d5 2b 77 00 48 0f ba 2b 03 e9 6a fa ff ff e8 c6 8f 2b 00 0f 0b e9 5a fc ff ff e8 ba 8f 2b 00 <0f> 0b 45 31 f6 e9 4b fc ff ff e8 eb 28 77 00 e9 3a fb ff ff e8 a1 > RSP: 0018:ffffc90003d1ee00 EFLAGS: 00010293 > Not bad guess. Moving work initialization upper, since rewriting error handling is boring #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master With regards, Pavel Skripkin [-- Attachment #1.1.2: ph --] [-- Type: text/plain, Size: 1141 bytes --] diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index cd7b118d5929..f3a38f106212 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2569,6 +2569,11 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, } while (0); mutex_unlock(&pvr2_unit_mtx); + INIT_WORK(&hdw->workpoll,pvr2_hdw_worker_poll); + + if (hdw->unit_number == -1) + goto fail; + cnt1 = 0; cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); cnt1 += cnt2; @@ -2580,8 +2585,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, if (cnt1 >= sizeof(hdw->name)) cnt1 = sizeof(hdw->name)-1; hdw->name[cnt1] = 0; - INIT_WORK(&hdw->workpoll,pvr2_hdw_worker_poll); - pvr2_trace(PVR2_TRACE_INIT,"Driver unit number is %d, name is %s", hdw->unit_number,hdw->name); @@ -2600,7 +2603,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, mutex_init(&hdw->big_lock_mutex); return hdw; - fail: +fail: if (hdw) { del_timer_sync(&hdw->quiescent_timer); del_timer_sync(&hdw->decoder_stabilization_timer); [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init 2022-04-14 20:18 ` Pavel Skripkin @ 2022-04-14 23:31 ` syzbot 0 siblings, 0 replies; 5+ messages in thread From: syzbot @ 2022-04-14 23:31 UTC (permalink / raw) To: isely, linux-kernel, linux-media, mchehab, paskripkin, syzkaller-bugs Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-and-tested-by: syzbot+1a247e36149ffd709a9b@syzkaller.appspotmail.com Tested on: commit: 115acbb5 Merge tag 's390-5.18-3' of git://git.kernel.o.. git tree: upstream kernel config: https://syzkaller.appspot.com/x/.config?x=eb177500e563582f dashboard link: https://syzkaller.appspot.com/bug?extid=1a247e36149ffd709a9b 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=113c24e0f00000 Note: testing is done by a robot and is best-effort only. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-14 23:31 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-04-14 18:47 [syzbot] UBSAN: array-index-out-of-bounds in pvr2_i2c_core_init syzbot 2022-04-14 20:04 ` Pavel Skripkin 2022-04-14 20:14 ` syzbot 2022-04-14 20:18 ` Pavel Skripkin 2022-04-14 23:31 ` syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).