media: em28xx: NULL pointer dereference in em28xx_close_extension() on disconnect/unload
Subsystems (3)
Hi,
Commit 826915b6b65e ("media: em28xx: fix use-after-free of dev_next->devlist on disconnect", CVE-2026-89891) introduces a 100% reproducible kernel NULL pointer dereference in em28xx_close_extension() on real dual-TS hardware (Hauppauge WinTV-dualHD, USB ID 2040:8265) whenever the device disconnects or the em28xx module is unloaded.
#regzbot introduced: 826915b6b65e
Impact
------
When triggered by a USB disconnect, the Oops kills the kworker thread on usb_hub_wq (hub_event -> usb_disconnect -> usb_disable_device -> usb_unbind_interface -> em28xx_usb_disconnect -> em28xx_close_extension) while the USB device/hub lock is held. This permanently deadlocks USB enumeration/lsusb and container/device teardown until a full host reboot.
When triggered by modprobe -r em28xx_dvb em28xx_rc em28xx, modprobe is killed (SIGKILL) leaving em28xx stuck in initstate "going" (refcnt -1).
Hardware & Kernels Affected
---------------------------
- Hardware: Dell Inc. OptiPlex 3070 (Intel Cannon Lake PCH xHCI 0000:00:14.0)
- USB Device: Hauppauge WinTV-dualHD (2040:8265, has_dual_ts = 1, is_audio_only = 0)
- Observed identically on Proxmox VE kernels (in-tree em28xx module; taint flags are only from ZFS/r8125 OOT modules and are unrelated):
- 7.0.14-23-pve (2026-10-27, usb_hub_wq disconnect)
- 7.0.14-26-pve (2026-10-28, usb_hub_wq disconnect)
- 7.0.14-28-pve (2026-11-07, usb_hub_wq disconnect)
- 7.0.14-29-pve (2026-11-18, modprobe -r reproducer)
Reproducer
----------
With a Hauppauge WinTV-dualHD (2040:8265) attached (and no userspace holding /dev/dvb/*):
# modprobe -r em28xx_dvb em28xx_rc em28xx (or physically unplugging / resetting the USB stick).
Root Cause Analysis
-------------------
For normal dual-TS devices (has_dual_ts = 1, is_audio_only = 0), only the primary dev is inserted into em28xx_devlist; dev->dev_next->devlist is never added to em28xx_devlist (and remains zero-initialized with next == NULL, prev == NULL).
Disassembly of the crashing Code bytes at em28xx_close_extension+0x80/0x140:
mov 0x17a0(%r12),%rbx ; rbx = dev->dev_next (ffff8ba4513fe000) test %rbx,%rbx ; if (!dev->dev_next)
je +0x4b
mov 0x1f0(%rbx),%rax ; rax = dev->dev_next->devlist.prev == 0x0 mov 0x1e8(%rbx),%rdx ; rdx = dev->dev_next->devlist.next == 0x0 lea 0x1e8(%rbx),%rdi ; rdi = &dev->dev_next->devlist (ffff8ba4513fe1e8) cmp (%rax),%rdi ; <-- #PF CR2=0x0 in list_del(&dev->dev_next->devlist)
Because dev->dev_next->devlist.next and .prev are NULL (0x0), list_del(&dev->dev_next->devlist) unconditionally dereferences NULL inside __list_del_entry_valid().
If em28xx_devlist is only supposed to hold primary devices (as addressed by commit 95f76f51937f "media: em28xx: defer audio-only extension registration"), list_del(&dev->dev_next->devlist) should either be removed or guarded (e.g., initialized with INIT_LIST_HEAD(&dev_next->devlist) and checked with !list_empty(&dev->dev_next->devlist) or dev->dev_next->devlist.next).
Trace 1: Spontaneous USB Disconnect (deadlocks usb_hub_wq)
----------------------------------------------------------
usb 1-2: USB disconnect, device number 2
em28xx 1-2:1.0: Disconnecting em28xx #1
em28xx 1-2:1.0: Disconnecting em28xx
em28xx 1-2:1.0: Closing DVB extension
em28xx 1-2:1.0: Closing DVB extension
em28xx 1-2:1.0: Closing input extension
em28xx 1-2:1.0: Closing input extension
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP PTI CPU: 4 UID: 0 PID: 3086307 Comm: kworker/4:1 Tainted: P S OE 7.0.14-28-pve #2 PREEMPT(lazy) Tainted: [P]=PROPRIETARY_MODULE, [S]=CPU_OUT_OF_SPEC, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: Dell Inc. OptiPlex 3070/02N3WF, BIOS 1.33.0 03/26/2025 Workqueue: usb_hub_wq hub_event RIP: 0010:em28xx_close_extension+0x80/0x140 [em28xx] Code: 81 fb 50 82 3c c1 75 cd 49 8b 9c 24 a0 17 00 00 48 85 db 74 4b 48 8b 83 f0 01 00 00 48 8b 93 e8 01 00 00 48 8d bb e8 01 00 00 <48> 3b 38 0f 85 fa 26 00 00 48 3b 7a 08 0f 85 f0 26 00 00 48 89 42 RSP: 0000:ffffcf6822097af8 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff8ba4513fe000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8ba4513fe1e8 RBP: ffffcf6822097b08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8ba45576c000 R13: ffff8ba4461dd8e0 R14: ffffffffc13c8590 R15: ffff8ba4461dd850 FS: 0000000000000000(0000) GS:ffff8babd7908000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000005f5b86004 CR4: 00000000003726f0 Call Trace: <TASK> em28xx_usb_disconnect.cold+0x71/0xbf [em28xx] usb_unbind_interface+0x9b/0x2e0 device_remove+0x68/0x80 device_release_driver_internal+0x206/0x270 device_release_driver+0x12/0x20 bus_remove_device+0xfd/0x1c0 ? device_remove_attrs+0xb6/0x100 device_del+0x160/0x3c0 usb_disable_device+0xea/0x240 usb_disconnect+0xe6/0x2e0 hub_event+0xe8c/0x1a40 process_one_work+0x1a9/0x3c0 worker_thread+0x1b8/0x360 ? __pfx_worker_thread+0x10/0x10 kthread+0xf7/0x130 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2da/0x3a0 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK>
note: kworker/4:1[3086307] exited with irqs disabled
Trace 2: Deterministic Reproducer (modprobe -r em28xx_dvb em28xx_rc em28xx)
-----------------------------------------------------------------------------
em28xx 1-2:1.0: Closing DVB extension
em28xx 1-2:1.0: Closing DVB extension
em28xx: Removed (Em28xx dvb Extension) extension
em28xx 1-2:1.0: Closing input extension
em28xx 1-2:1.0: Closing input extension
em28xx: Removed (Em28xx Input Extension) extension
usbcore: deregistering interface driver em28xx
em28xx 1-2:1.0: Disconnecting em28xx #1
em28xx 1-2:1.0: Disconnecting em28xx
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP PTI CPU: 3 UID: 0 PID: 151085 Comm: modprobe Tainted: P S OE 7.0.14-29-pve #1 PREEMPT(lazy) Tainted: [P]=PROPRIETARY_MODULE, [S]=CPU_OUT_OF_SPEC, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: Dell Inc. OptiPlex 3070/02N3WF, BIOS 1.33.0 03/26/2025 RIP: 0010:em28xx_close_extension+0x80/0x140 [em28xx] Code: 81 fb 50 f2 14 c1 75 cd 49 8b 9c 24 a0 17 00 00 48 85 db 74 4b 48 8b 83 f0 01 00 00 48 8b 93 e8 01 00 00 48 8d bb e8 01 00 00 <48> 3b 38 0f 85 fa 26 00 00 48 3b 7a 08 0f 85 f0 26 00 00 48 89 42 RSP: 0018:ffffcadcb18d3b80 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff8a28c5d92000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8a28c5d921e8 RBP: ffffcadcb18d3b90 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8a28c5d96000 R13: ffff8a28df3b60e0 R14: ffffffffc114f590 R15: ffff8a28df3b6050 FS: 0000747342ef1640(0000) GS:ffff8a304b888000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000049f936006 CR4: 00000000003726f0 Call Trace: <TASK> em28xx_usb_disconnect.cold+0x71/0xbf [em28xx] usb_unbind_interface+0x9b/0x2e0 device_remove+0x68/0x80 device_release_driver_internal+0x206/0x270 driver_detach+0x4a/0xa0 bus_remove_driver+0x83/0x120 driver_unregister+0x2f/0x60 usb_deregister+0x81/0x109 em28xx_usb_driver_exit+0x10/0xf90 [em28xx] __do_sys_delete_module.isra.0+0x1c3/0x2f0 __x64_sys_delete_module+0x12/0x20 x64_sys_call+0x20c3/0x2390 do_syscall_64+0x10b/0x14c0 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
note: modprobe[151085] exited with irqs disabled
Happy to test a patch on this hardware.
Regards,
Paweł Ziemniak
Quoted 8 lines · Paweł Ziemniak
Commit
826915b6b65e("media: em28xx: fix use-after-free of dev_next-Quoted 1 line
devlist on disconnect",
CVE-2026-89891) introduces a 100% reproducible kernel NULL pointer dereference in
em28xx_close_extension()on real dual-TS hardware (Hauppauge WinTV- dualHD, USB ID 2040:8265)
whenever the device disconnects or the em28xx module is unloaded.
This is not my area of expertise, so the following might be sending you in the wrong direction. But FWIW:
From a very quick look this seems to be the problem that was reported earlier; a fix is discussed here:
[PATCH] media: em28xx: fix NULL pointer dereference on disconnect of dual-TS devices
https://lore.kernel.org/all/[email protected]/
If your's is a different problem, please let us know.
Ciao, Thorsten
Thank you, that seems to be the same problem, I'm sorry I missed that.
I backported and tested commit b0bb9a4fe0d3 from linux-next ("media: em28xx: fix NULL pointer dereference on disconnect of dual-TS devices") against 7.0.14-29-pve on my Hauppauge WinTV-dualHD (2040:8265).
Unloading/reloading (modprobe -r em28xx_dvb em28xx_rc em28xx + modprobe em28xx) and USB disconnect now complete cleanly with no Oops and no USB hang.
#regzbot fix: media: em28xx: fix NULL pointer dereference on disconnect of dual-TS devices
Regards,
Paweł Ziemniak
W dniu 2026-11-19 o 06:44, Thorsten Leemhuis pisze:
Quoted 21 lines · Paweł Ziemniak
Quoted 7 lines
Commit
826915b6b65e("media: em28xx: fix use-after-free of dev_next-Quoted 1 line
devlist on disconnect",
CVE-2026-89891) introduces a 100% reproducible kernel NULL pointer dereference in
em28xx_close_extension()on real dual-TS hardware (Hauppauge WinTV- dualHD, USB ID 2040:8265)
whenever the device disconnects or the em28xx module is unloaded.This is not my area of expertise, so the following might be sending you in the wrong direction. But FWIW:
From a very quick look this seems to be the problem that was reported
earlier; a fix is discussed here:[PATCH] media: em28xx: fix NULL pointer dereference on disconnect of dual-TS devices
https://lore.kernel.org/all/[email protected]/If your's is a different problem, please let us know.
Ciao, Thorsten