Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
* WARNING in em28xx_usb_disconnect
@ 2019-08-09 13:18 syzbot
  2019-08-11  5:11 ` [PATCH] media: em28xx: modules workqueue not inited for 2nd device Sean Young
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2019-08-09 13:18 UTC (permalink / raw)
  To: andreyknvl, linux-kernel, linux-media, linux-usb, mchehab,
	syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    e96407b4 usb-fuzzer: main usb gadget fuzzer driver
git tree:       https://github.com/google/kasan.git usb-fuzzer
console output: https://syzkaller.appspot.com/x/log.txt?x=15ef3cba600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=cfa2c18fb6a8068e
dashboard link: https://syzkaller.appspot.com/bug?extid=b7f57261c521087d89bb
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16ceae36600000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12816f26600000

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

usb 1-1: USB disconnect, device number 2
em28xx 1-1:1.153: Disconnecting em28xx #1
------------[ cut here ]------------
WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031  
__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0xca/0x13e lib/dump_stack.c:113
  panic+0x2a3/0x6da kernel/panic.c:219
  __warn.cold+0x20/0x4a kernel/panic.c:576
  report_bug+0x262/0x2a0 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:179 [inline]
  fixup_bug arch/x86/kernel/traps.c:174 [inline]
  do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
  do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
  invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86  
ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4  
e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
  flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
  em28xx_usb_disconnect.cold+0x280/0x2a6  
drivers/media/usb/em28xx/em28xx-cards.c:4023
  usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
  __device_release_driver drivers/base/dd.c:1120 [inline]
  device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
  bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
  device_del+0x420/0xb10 drivers/base/core.c:2288
  usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
  usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
  hub_port_connect drivers/usb/core/hub.c:4949 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
  port_event drivers/usb/core/hub.c:5359 [inline]
  hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
  process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
  process_scheduled_works kernel/workqueue.c:2331 [inline]
  worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
  kthread+0x318/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
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.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

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

* [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-09 13:18 WARNING in em28xx_usb_disconnect syzbot
@ 2019-08-11  5:11 ` Sean Young
  2019-08-12 13:21   ` Ezequiel Garcia
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Young @ 2019-08-11  5:11 UTC (permalink / raw)
  To: syzbot
  Cc: andreyknvl, linux-kernel, linux-media, linux-usb, mchehab,
	syzkaller-bugs

syzbot reports an error on flush_request_modules() for the second device.
This workqueue was never initialised so simply remove the offending line.

usb 1-1: USB disconnect, device number 2
em28xx 1-1:1.153: Disconnecting em28xx #1
------------[ cut here ]------------
WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0xca/0x13e lib/dump_stack.c:113
  panic+0x2a3/0x6da kernel/panic.c:219
  __warn.cold+0x20/0x4a kernel/panic.c:576
  report_bug+0x262/0x2a0 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:179 [inline]
  fixup_bug arch/x86/kernel/traps.c:174 [inline]
  do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
  do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
  invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
  flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
  em28xx_usb_disconnect.cold+0x280/0x2a6
drivers/media/usb/em28xx/em28xx-cards.c:4023
  usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
  __device_release_driver drivers/base/dd.c:1120 [inline]
  device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
  bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
  device_del+0x420/0xb10 drivers/base/core.c:2288
  usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
  usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
  hub_port_connect drivers/usb/core/hub.c:4949 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
  port_event drivers/usb/core/hub.c:5359 [inline]
  hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
  process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
  process_scheduled_works kernel/workqueue.c:2331 [inline]
  worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
  kthread+0x318/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Kernel Offset: disabled
Rebooting in 86400 seconds..

Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/usb/em28xx/em28xx-cards.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 6e33782c3ca6..5983e72a0622 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
 		dev->dev_next->disconnected = 1;
 		dev_info(&dev->intf->dev, "Disconnecting %s\n",
 			 dev->dev_next->name);
-		flush_request_modules(dev->dev_next);
 	}
 
 	dev->disconnected = 1;
-- 
2.21.0


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

* Re: [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-11  5:11 ` [PATCH] media: em28xx: modules workqueue not inited for 2nd device Sean Young
@ 2019-08-12 13:21   ` Ezequiel Garcia
  2019-08-13  7:35     ` Sean Young
  2019-08-13  9:10     ` Sean Young
  0 siblings, 2 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2019-08-12 13:21 UTC (permalink / raw)
  To: Sean Young, syzbot
  Cc: andreyknvl, linux-kernel, linux-media, linux-usb, mchehab,
	syzkaller-bugs

On Sun, 2019-08-11 at 06:11 +0100, Sean Young wrote:
> syzbot reports an error on flush_request_modules() for the second device.
> This workqueue was never initialised so simply remove the offending line.
> 
> usb 1-1: USB disconnect, device number 2
> em28xx 1-1:1.153: Disconnecting em28xx #1
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
> __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> Kernel panic - not syncing: panic_on_warn set ...
> CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Workqueue: usb_hub_wq hub_event
> Call Trace:
>   __dump_stack lib/dump_stack.c:77 [inline]
>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>   panic+0x2a3/0x6da kernel/panic.c:219
>   __warn.cold+0x20/0x4a kernel/panic.c:576
>   report_bug+0x262/0x2a0 lib/bug.c:186
>   fixup_bug arch/x86/kernel/traps.c:179 [inline]
>   fixup_bug arch/x86/kernel/traps.c:174 [inline]
>   do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
>   do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
>   invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
> RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
> ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
> e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
> RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
> RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
> RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
> R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
> R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
>   flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
>   em28xx_usb_disconnect.cold+0x280/0x2a6
> drivers/media/usb/em28xx/em28xx-cards.c:4023
>   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
>   __device_release_driver drivers/base/dd.c:1120 [inline]
>   device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
>   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
>   device_del+0x420/0xb10 drivers/base/core.c:2288
>   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
>   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
>   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
>   port_event drivers/usb/core/hub.c:5359 [inline]
>   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
>   process_scheduled_works kernel/workqueue.c:2331 [inline]
>   worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
>   kthread+0x318/0x420 kernel/kthread.c:255
>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
> 
> Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
> Signed-off-by: Sean Young <sean@mess.org>

I reviewed the syzbot report, but was left head-scratching and
failing to see how the module-loading worker was supposed to be used :-)

Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>

Also, this seems a bug, so how about this tag?

Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality)

> ---
>  drivers/media/usb/em28xx/em28xx-cards.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> index 6e33782c3ca6..5983e72a0622 100644
> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> @@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
>  		dev->dev_next->disconnected = 1;
>  		dev_info(&dev->intf->dev, "Disconnecting %s\n",
>  			 dev->dev_next->name);
> -		flush_request_modules(dev->dev_next);
>  	}
>  
>  	dev->disconnected = 1;



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

* Re: [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-12 13:21   ` Ezequiel Garcia
@ 2019-08-13  7:35     ` Sean Young
  2019-08-13  9:10     ` Sean Young
  1 sibling, 0 replies; 7+ messages in thread
From: Sean Young @ 2019-08-13  7:35 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: syzbot, andreyknvl, linux-kernel, linux-media, linux-usb,
	mchehab, syzkaller-bugs

On Mon, Aug 12, 2019 at 10:21:39AM -0300, Ezequiel Garcia wrote:
> On Sun, 2019-08-11 at 06:11 +0100, Sean Young wrote:
> > syzbot reports an error on flush_request_modules() for the second device.
> > This workqueue was never initialised so simply remove the offending line.
> > 
> > usb 1-1: USB disconnect, device number 2
> > em28xx 1-1:1.153: Disconnecting em28xx #1
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
> > __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> > Kernel panic - not syncing: panic_on_warn set ...
> > CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > Workqueue: usb_hub_wq hub_event
> > Call Trace:
> >   __dump_stack lib/dump_stack.c:77 [inline]
> >   dump_stack+0xca/0x13e lib/dump_stack.c:113
> >   panic+0x2a3/0x6da kernel/panic.c:219
> >   __warn.cold+0x20/0x4a kernel/panic.c:576
> >   report_bug+0x262/0x2a0 lib/bug.c:186
> >   fixup_bug arch/x86/kernel/traps.c:179 [inline]
> >   fixup_bug arch/x86/kernel/traps.c:174 [inline]
> >   do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
> >   do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
> >   invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
> > RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> > Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
> > ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
> > e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
> > RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
> > RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
> > RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
> > RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
> > R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
> > R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
> >   flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
> >   em28xx_usb_disconnect.cold+0x280/0x2a6
> > drivers/media/usb/em28xx/em28xx-cards.c:4023
> >   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
> >   __device_release_driver drivers/base/dd.c:1120 [inline]
> >   device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
> >   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
> >   device_del+0x420/0xb10 drivers/base/core.c:2288
> >   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
> >   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
> >   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
> >   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
> >   port_event drivers/usb/core/hub.c:5359 [inline]
> >   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
> >   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
> >   process_scheduled_works kernel/workqueue.c:2331 [inline]
> >   worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
> >   kthread+0x318/0x420 kernel/kthread.c:255
> >   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
> > Kernel Offset: disabled
> > Rebooting in 86400 seconds..
> > 
> > Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
> > Signed-off-by: Sean Young <sean@mess.org>
> 
> I reviewed the syzbot report, but was left head-scratching and
> failing to see how the module-loading worker was supposed to be used :-)
> 
> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
> 
> Also, this seems a bug, so how about this tag?
> 
> Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality)

Thank you for the review and yes it does need that tag.

Thanks
sean

> 
> > ---
> >  drivers/media/usb/em28xx/em28xx-cards.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> > index 6e33782c3ca6..5983e72a0622 100644
> > --- a/drivers/media/usb/em28xx/em28xx-cards.c
> > +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> > @@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
> >  		dev->dev_next->disconnected = 1;
> >  		dev_info(&dev->intf->dev, "Disconnecting %s\n",
> >  			 dev->dev_next->name);
> > -		flush_request_modules(dev->dev_next);
> >  	}
> >  
> >  	dev->disconnected = 1;
> 

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

* Re: [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-12 13:21   ` Ezequiel Garcia
  2019-08-13  7:35     ` Sean Young
@ 2019-08-13  9:10     ` Sean Young
  2019-08-13 18:48       ` Brad Love
  1 sibling, 1 reply; 7+ messages in thread
From: Sean Young @ 2019-08-13  9:10 UTC (permalink / raw)
  To: Brad Love
  Cc: Ezequiel Garcia, syzbot, andreyknvl, linux-kernel, linux-media,
	linux-usb, mchehab, syzkaller-bugs

Hi Brad,

On Mon, Aug 12, 2019 at 10:21:39AM -0300, Ezequiel Garcia wrote:
> On Sun, 2019-08-11 at 06:11 +0100, Sean Young wrote:
> > syzbot reports an error on flush_request_modules() for the second device.
> > This workqueue was never initialised so simply remove the offending line.
> > 
> > usb 1-1: USB disconnect, device number 2
> > em28xx 1-1:1.153: Disconnecting em28xx #1
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
> > __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> > Kernel panic - not syncing: panic_on_warn set ...
> > CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > Workqueue: usb_hub_wq hub_event
> > Call Trace:
> >   __dump_stack lib/dump_stack.c:77 [inline]
> >   dump_stack+0xca/0x13e lib/dump_stack.c:113
> >   panic+0x2a3/0x6da kernel/panic.c:219
> >   __warn.cold+0x20/0x4a kernel/panic.c:576
> >   report_bug+0x262/0x2a0 lib/bug.c:186
> >   fixup_bug arch/x86/kernel/traps.c:179 [inline]
> >   fixup_bug arch/x86/kernel/traps.c:174 [inline]
> >   do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
> >   do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
> >   invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
> > RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> > Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
> > ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
> > e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
> > RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
> > RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
> > RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
> > RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
> > R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
> > R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
> >   flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
> >   em28xx_usb_disconnect.cold+0x280/0x2a6
> > drivers/media/usb/em28xx/em28xx-cards.c:4023
> >   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
> >   __device_release_driver drivers/base/dd.c:1120 [inline]
> >   device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
> >   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
> >   device_del+0x420/0xb10 drivers/base/core.c:2288
> >   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
> >   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
> >   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
> >   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
> >   port_event drivers/usb/core/hub.c:5359 [inline]
> >   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
> >   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
> >   process_scheduled_works kernel/workqueue.c:2331 [inline]
> >   worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
> >   kthread+0x318/0x420 kernel/kthread.c:255
> >   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
> > Kernel Offset: disabled
> > Rebooting in 86400 seconds..
> > 
> > Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
> > Signed-off-by: Sean Young <sean@mess.org>
> 
> I reviewed the syzbot report, but was left head-scratching and
> failing to see how the module-loading worker was supposed to be used :-)
> 
> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
> 
> Also, this seems a bug, so how about this tag?
> 
> Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality)

Would you mind reviewing this change please Brad? You added the dual_ts
feature to the driver so it would be good to have your view on this.

Thanks
Sean

> 
> > ---
> >  drivers/media/usb/em28xx/em28xx-cards.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> > index 6e33782c3ca6..5983e72a0622 100644
> > --- a/drivers/media/usb/em28xx/em28xx-cards.c
> > +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> > @@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
> >  		dev->dev_next->disconnected = 1;
> >  		dev_info(&dev->intf->dev, "Disconnecting %s\n",
> >  			 dev->dev_next->name);
> > -		flush_request_modules(dev->dev_next);
> >  	}
> >  
> >  	dev->disconnected = 1;
> 

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

* Re: [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-13  9:10     ` Sean Young
@ 2019-08-13 18:48       ` Brad Love
  2019-08-13 20:21         ` Sean Young
  0 siblings, 1 reply; 7+ messages in thread
From: Brad Love @ 2019-08-13 18:48 UTC (permalink / raw)
  To: Sean Young, Brad Love
  Cc: Ezequiel Garcia, syzbot, andreyknvl, linux-kernel, linux-media,
	linux-usb, mchehab, syzkaller-bugs

Hey Sean,


On 13/08/2019 04.10, Sean Young wrote:
> Hi Brad,
>
> On Mon, Aug 12, 2019 at 10:21:39AM -0300, Ezequiel Garcia wrote:
>> On Sun, 2019-08-11 at 06:11 +0100, Sean Young wrote:
>>> syzbot reports an error on flush_request_modules() for the second device.
>>> This workqueue was never initialised so simply remove the offending line.
>>>
>>> usb 1-1: USB disconnect, device number 2
>>> em28xx 1-1:1.153: Disconnecting em28xx #1
>>> ------------[ cut here ]------------
>>> WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
>>> __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
>>> Kernel panic - not syncing: panic_on_warn set ...
>>> CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>>> Google 01/01/2011
>>> Workqueue: usb_hub_wq hub_event
>>> Call Trace:
>>>   __dump_stack lib/dump_stack.c:77 [inline]
>>>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>>>   panic+0x2a3/0x6da kernel/panic.c:219
>>>   __warn.cold+0x20/0x4a kernel/panic.c:576
>>>   report_bug+0x262/0x2a0 lib/bug.c:186
>>>   fixup_bug arch/x86/kernel/traps.c:179 [inline]
>>>   fixup_bug arch/x86/kernel/traps.c:174 [inline]
>>>   do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
>>>   do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
>>>   invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
>>> RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
>>> Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
>>> ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
>>> e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
>>> RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
>>> RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
>>> RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
>>> RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
>>> R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
>>> R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
>>>   flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
>>>   em28xx_usb_disconnect.cold+0x280/0x2a6
>>> drivers/media/usb/em28xx/em28xx-cards.c:4023
>>>   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
>>>   __device_release_driver drivers/base/dd.c:1120 [inline]
>>>   device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
>>>   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
>>>   device_del+0x420/0xb10 drivers/base/core.c:2288
>>>   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
>>>   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
>>>   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
>>>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
>>>   port_event drivers/usb/core/hub.c:5359 [inline]
>>>   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
>>>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
>>>   process_scheduled_works kernel/workqueue.c:2331 [inline]
>>>   worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
>>>   kthread+0x318/0x420 kernel/kthread.c:255
>>>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>>> Kernel Offset: disabled
>>> Rebooting in 86400 seconds..
>>>
>>> Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
>>> Signed-off-by: Sean Young <sean@mess.org>
>> I reviewed the syzbot report, but was left head-scratching and
>> failing to see how the module-loading worker was supposed to be used :-)
>>
>> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
>>
>> Also, this seems a bug, so how about this tag?
>>
>> Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality)
> Would you mind reviewing this change please Brad? You added the dual_ts
> feature to the driver so it would be good to have your view on this.
>
> Thanks
> Sean


Hmmm. I've never encountered this oops, nor had it reported to me. Looks
like the second device indeed never calls request_modules, and when I
did the cleanup I just duplicated all the teardown. Since everything
works without the second workqueue already, I don't think the second
device needs to initialize it's own. So, I think your solution is proper.


Reviewed-by: Brad Love <brad@nextdimension.cc>



>>> ---
>>>  drivers/media/usb/em28xx/em28xx-cards.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
>>> index 6e33782c3ca6..5983e72a0622 100644
>>> --- a/drivers/media/usb/em28xx/em28xx-cards.c
>>> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
>>> @@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
>>>  		dev->dev_next->disconnected = 1;
>>>  		dev_info(&dev->intf->dev, "Disconnecting %s\n",
>>>  			 dev->dev_next->name);
>>> -		flush_request_modules(dev->dev_next);
>>>  	}
>>>  
>>>  	dev->disconnected = 1;


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

* Re: [PATCH] media: em28xx: modules workqueue not inited for 2nd device
  2019-08-13 18:48       ` Brad Love
@ 2019-08-13 20:21         ` Sean Young
  0 siblings, 0 replies; 7+ messages in thread
From: Sean Young @ 2019-08-13 20:21 UTC (permalink / raw)
  To: Brad Love
  Cc: Ezequiel Garcia, syzbot, andreyknvl, linux-kernel, linux-media,
	linux-usb, mchehab, syzkaller-bugs

Hi Brad,

On Tue, Aug 13, 2019 at 01:48:34PM -0500, Brad Love wrote:
> > On Mon, Aug 12, 2019 at 10:21:39AM -0300, Ezequiel Garcia wrote:
> >> On Sun, 2019-08-11 at 06:11 +0100, Sean Young wrote:
> >>> syzbot reports an error on flush_request_modules() for the second device.
> >>> This workqueue was never initialised so simply remove the offending line.
> >>>
> >>> usb 1-1: USB disconnect, device number 2
> >>> em28xx 1-1:1.153: Disconnecting em28xx #1
> >>> ------------[ cut here ]------------
> >>> WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
> >>> __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> >>> Kernel panic - not syncing: panic_on_warn set ...
> >>> CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
> >>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> >>> Google 01/01/2011
> >>> Workqueue: usb_hub_wq hub_event
> >>> Call Trace:
> >>>   __dump_stack lib/dump_stack.c:77 [inline]
> >>>   dump_stack+0xca/0x13e lib/dump_stack.c:113
> >>>   panic+0x2a3/0x6da kernel/panic.c:219
> >>>   __warn.cold+0x20/0x4a kernel/panic.c:576
> >>>   report_bug+0x262/0x2a0 lib/bug.c:186
> >>>   fixup_bug arch/x86/kernel/traps.c:179 [inline]
> >>>   fixup_bug arch/x86/kernel/traps.c:174 [inline]
> >>>   do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
> >>>   do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
> >>>   invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
> >>> RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
> >>> Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
> >>> ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
> >>> e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
> >>> RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
> >>> RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
> >>> RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
> >>> RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
> >>> R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
> >>> R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
> >>>   flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
> >>>   em28xx_usb_disconnect.cold+0x280/0x2a6
> >>> drivers/media/usb/em28xx/em28xx-cards.c:4023
> >>>   usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
> >>>   __device_release_driver drivers/base/dd.c:1120 [inline]
> >>>   device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
> >>>   bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
> >>>   device_del+0x420/0xb10 drivers/base/core.c:2288
> >>>   usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
> >>>   usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
> >>>   hub_port_connect drivers/usb/core/hub.c:4949 [inline]
> >>>   hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
> >>>   port_event drivers/usb/core/hub.c:5359 [inline]
> >>>   hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
> >>>   process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
> >>>   process_scheduled_works kernel/workqueue.c:2331 [inline]
> >>>   worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
> >>>   kthread+0x318/0x420 kernel/kthread.c:255
> >>>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
> >>> Kernel Offset: disabled
> >>> Rebooting in 86400 seconds..
> >>>
> >>> Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
> >>> Signed-off-by: Sean Young <sean@mess.org>
> >> I reviewed the syzbot report, but was left head-scratching and
> >> failing to see how the module-loading worker was supposed to be used :-)
> >>
> >> Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
> >>
> >> Also, this seems a bug, so how about this tag?
> >>
> >> Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality)
> > Would you mind reviewing this change please Brad? You added the dual_ts
> > feature to the driver so it would be good to have your view on this.
> >
> > Thanks
> > Sean
> 
> 
> Hmmm. I've never encountered this oops, nor had it reported to me. Looks
> like the second device indeed never calls request_modules, and when I
> did the cleanup I just duplicated all the teardown. Since everything
> works without the second workqueue already, I don't think the second
> device needs to initialize it's own. So, I think your solution is proper.
> 
> 
> Reviewed-by: Brad Love <brad@nextdimension.cc>

Great, thank you!

If I understand this correctly, then if you build your kernel with KASAN
and UBSAN then I _think_ this is caught.

Thanks
Sean

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 13:18 WARNING in em28xx_usb_disconnect syzbot
2019-08-11  5:11 ` [PATCH] media: em28xx: modules workqueue not inited for 2nd device Sean Young
2019-08-12 13:21   ` Ezequiel Garcia
2019-08-13  7:35     ` Sean Young
2019-08-13  9:10     ` Sean Young
2019-08-13 18:48       ` Brad Love
2019-08-13 20:21         ` Sean Young

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org linux-media@archiver.kernel.org
	public-inbox-index linux-media


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/ public-inbox