Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: unable to handle kernel NULL pointer dereference in __videobuf_free
zr364xx 2-1:0.0: model 06d6:003b detected
usb 2-1: 320x240 mode selected
zr364xx: start read pipe failed
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 118675067 P4D 118675067 PUD 1082de067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
CPU: 0 PID: 10599 Comm: kworker/0:5 Not tainted 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:__videobuf_free+0x62/0x180 drivers/media/v4l2-core/videobuf-core.c:243
Code: 9d 70 01 00 00 31 ff 83 e3 03 89 de e8 b7 da 4a fe 84 db 0f 85 00 01 00 00 e8 2a e1 4a fe 48 8b 85 68 01 00 00 bf 03 10 26 12 <44> 8b 20 44 89 e6 e8 d3 da 4a fe 41 81 fc 03 10 26 12 0f 85 c4 2c
RSP: 0018:ffffc90002d3f7b8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff82e82989
RDX: ffff888113d9d000 RSI: ffffffff82e82996 RDI: 0000000012261003
RBP: ffff888126d5f780 R08: ffff888126d0fab8 R09: 00000000000008fd
R10: 0000000000000000 R11: 3a7878343633727a R12: 0000000000000001
R13: ffff888126d5f000 R14: ffffc90002e81000 R15: 00000000ffffffa6
FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000118654000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
videobuf_mmap_free+0x1f/0x60 drivers/media/v4l2-core/videobuf-core.c:377
zr364xx_release+0x26/0xa0 drivers/media/usb/zr364xx/zr364xx.c:1192
v4l2_device_release drivers/media/v4l2-core/v4l2-device.c:51 [inline]
kref_put include/linux/kref.h:65 [inline]
v4l2_device_put+0x82/0xc0 drivers/media/v4l2-core/v4l2-device.c:56
zr364xx_probe+0x80c/0x823 drivers/media/usb/zr364xx/zr364xx.c:1536
usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
really_probe+0x159/0x480 drivers/base/dd.c:554
driver_probe_device+0x84/0x100 drivers/base/dd.c:738
__device_attach_driver+0xee/0x110 drivers/base/dd.c:844
bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
__device_attach+0x122/0x250 drivers/base/dd.c:912
bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
device_add+0x5ac/0xc30 drivers/base/core.c:2936
usb_set_configuration+0x9de/0xb90 drivers/usb/core/message.c:2159
usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
really_probe+0x159/0x480 drivers/base/dd.c:554
driver_probe_device+0x84/0x100 drivers/base/dd.c:738
__device_attach_driver+0xee/0x110 drivers/base/dd.c:844
bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
__device_attach+0x122/0x250 drivers/base/dd.c:912
bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
device_add+0x5ac/0xc30 drivers/base/core.c:2936
usb_new_device.cold+0x166/0x578 drivers/usb/core/hub.c:2554
hub_port_connect drivers/usb/core/hub.c:5222 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5362 [inline]
port_event drivers/usb/core/hub.c:5508 [inline]
hub_event+0x144a/0x20d0 drivers/usb/core/hub.c:5590
process_one_work+0x27d/0x590 kernel/workqueue.c:2272
worker_thread+0x59/0x5d0 kernel/workqueue.c:2418
kthread+0x178/0x1b0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
Modules linked in:
CR2: 0000000000000000
---[ end trace 46aec711da91fb13 ]---
RIP: 0010:__videobuf_free+0x62/0x180 drivers/media/v4l2-core/videobuf-core.c:243
Code: 9d 70 01 00 00 31 ff 83 e3 03 89 de e8 b7 da 4a fe 84 db 0f 85 00 01 00 00 e8 2a e1 4a fe 48 8b 85 68 01 00 00 bf 03 10 26 12 <44> 8b 20 44 89 e6 e8 d3 da 4a fe 41 81 fc 03 10 26 12 0f 85 c4 2c
RSP: 0018:ffffc90002d3f7b8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff82e82989
RDX: ffff888113d9d000 RSI: ffffffff82e82996 RDI: 0000000012261003
RBP: ffff888126d5f780 R08: ffff888126d0fab8 R09: 00000000000008fd
R10: 0000000000000000 R11: 3a7878343633727a R12: 0000000000000001
R13: ffff888126d5f000 R14: ffffc90002e81000 R15: 00000000ffffffa6
FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000118654000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Tested on:
commit: a1714d22 media: zr364xx: Fix memory leak in ->probe()
git tree:
https://gitlab.collabora.com/linux/0day.git
console output:
https://syzkaller.appspot.com/x/log.txt?x=17ce3693500000
kernel config:
https://syzkaller.appspot.com/x/.config?x=ec2338be23ae163e