INFO: trying to register non-static key in dvb_frontend_release

Status: moderation: reported on 2026/12/05 00:26
Subsystems: media
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+3f1eaa314067abe93e5d@syzkaller.appspotmail.com
First crash: 1h45m, last: 1h45m
✨ AI cause bisection: introduced by (AI job) :
commit fe35637b0a9f8837a63ec4ffc52831de2af98fe4
Author: Max Kellermann <max@duempel.org>
Date: Mon Jul 4 12:08:51 2016 +0000

  [media] dvb_frontend: eliminate blocking wait in dvb_unregister_frontend()

✨ AI-generated root cause summary:

A lifecycle mismatch in the DVB core causes a use-after-free of struct dvb_adapter (fe->dvb) in dvb_frontend_release(). When a DVB frontend device is opened, dvb_frontend_open() takes a reference on struct dvb_frontend (fe->refcount) and struct dvb_device, but struct dvb_adapter is not reference-counted, and dvb_unregister_frontend() and dvb_unregister_adapter() return immediately without waiting for open file descriptors to close. Upon device disconnect, the driver frees the device structure embedding struct dvb_adapter while userspace still holds the frontend fd open. When the fd is later closed in dvb_frontend_release(), accessing fe->dvb->mdev_lock hits the freed (and here reallocated/zeroed) adapter memory, causing KASAN to see live heap memory while lockdep detects an uninitialized non-static lock key.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 007722b8211f:

Root Cause Analysis

The lockdep splat in dvb_frontend_release() (drivers/media/dvb-core/dvb_frontend.c:2942) is caused by a use-after-free of struct dvb_adapter (fe->dvb) due to missing lifetime synchronization between frontend/adapter unregistration and open frontend file descriptors.

1. Why mdev_lock Was Originally Initialized

  • A DVB adapter is registered via dvb_register_adapter() (drivers/media/dvb-core/dvbdev.c:890), which clears adap, initializes adap->device_list (line 917), and unconditionally initializes adap->mdev_lock via mutex_init(&adap->mdev_lock) (line 930, under CONFIG_MEDIA_CONTROLLER_DVB).
  • dvb_register_frontend() (drivers/media/dvb-core/dvb_frontend.c:3027) sets fe->dvb = dvb (line 3067) and registers the device node via dvb_register_device(fe->dvb, ...) (line 3074). Because dvb_register_device() inserts into &adap->device_list (drivers/media/dvb-core/dvbdev.c:524), dvb_register_adapter() must have already run on fe->dvb, meaning fe->dvb->mdev_lock was properly initialized with a static lockdep key at registration time.

2. The Lifecycle / Reference-Counting Defect

  1. Open takes a reference on fe and dvbdev, but not on fe->dvb:

    • When userspace opens /dev/dvb/adapterX/frontendY, dvb_device_open() (drivers/media/dvb-core/dvbdev.c:86) takes a reference on dvbdev (dvb_device_get(dvbdev)).
    • dvb_frontend_open() -> __dvb_frontend_open() (drivers/media/dvb-core/dvb_frontend.c:2764) calls dvb_generic_open() (decrementing dvbdev->users from -1 to -2) and dvb_frontend_get(fe) (incrementing fe->refcount).
    • Note that if opened with O_RDONLY, __dvb_frontend_open() skips the #ifdef CONFIG_MEDIA_CONTROLLER_DVB block (lines 2789-2819) and does not touch fe->dvb->mdev_lock.
    • Crucially, struct dvb_adapter (fe->dvb) has no reference count and no lifetime tie to open dvb_device or dvb_frontend instances.
  2. Unregistration does not wait for open file descriptors:

  3. Driver teardown frees struct dvb_adapter while the fd remains open:

    • On device disconnect or probe failure (e.g., in USB DVB drivers such as dvb-usb, dvb-usb-v2, ttusb-budget, or as102, which embed struct dvb_adapter inside their per-device struct d / ttusb / as102_dev_t), the driver immediately kfree()s the device structure containing struct dvb_adapter while userspace still holds the open frontend fd.

3. Triggering the Failure in dvb_frontend_release()

  • When the process exits (do_exit -> put_files_struct -> filp_close_sync -> __fput -> dvb_frontend_release), dvb_generic_release() increments dvbdev->users back to -1.
  • Because dvbdev->users == -1, dvb_frontend_release() executes:
    #ifdef CONFIG_MEDIA_CONTROLLER_DVB
            mutex_lock(&fe->dvb->mdev_lock);
            if (fe->dvb->mdev) {
                    mutex_lock(&fe->dvb->mdev->graph_mutex);
                    if (fe->dvb->mdev->disable_source)
                            fe->dvb->mdev->disable_source(dvbdev->entity);
                    mutex_unlock(&fe->dvb->mdev->graph_mutex);
            }
            mutex_unlock(&fe->dvb->mdev_lock);
    #endif
    
    (drivers/media/dvb-core/dvb_frontend.c:2941-2950) before calling dvb_frontend_put(fe) at line 2957.
  • fe->dvb is now a dangling pointer to the freed struct dvb_adapter.
  • When the freed heap object containing struct dvb_adapter is evicted from KASAN quarantine (or freed via kmalloc_large for large device structs) and reallocated and zeroed (kzalloc / __GFP_ZERO) before the fd is closed, KASAN sees valid live heap memory at &fe->dvb->mdev_lock. However, fe->dvb->mdev_lock.dep_map.key is NULL (0) at a non-static heap address, causing mutex_lock_nested() -> __mutex_lock_common() -> lock_acquire() -> __lock_acquire() -> register_lock_class() -> assign_lock_key() (kernel/locking/lockdep.c:1028) to report INFO: trying to register non-static key.

Related Lifecycle Issues in dvb_frontend_release()

In addition to fe->dvb (mdev_lock and mdev), dvb_remove_device() already freed dvbdev->entity via dvb_media_device_free(dvbdev) (drivers/media/dvb-core/dvbdev.c:604), and some drivers (e.g., vidtv_bridge_remove() -> dvb_module_release() -> vidtv_demod_i2c_remove() in drivers/media/test-drivers/vidtv/vidtv_demod.c:431) also free the memory embedding struct dvb_frontend itself without waiting for fe->refcount or dvbdev->users == -1.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
7ef283f7 bisect-cause IsRelease: ❌ ❓ INFO: trying to register non-static key in dvb_frontend_release 2026/12/04 23:43 2026/12/04 23:43 2026/12/05 00:42 976206f7
ef6b21b6 assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ✅ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ INFO: trying to register non-static key in dvb_frontend_release 2026/12/04 23:24 2026/12/04 23:24 2026/12/05 00:17 976206f7

Sample crash report:
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 0 UID: 0 PID: 11557 Comm: syz.4.1377 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 assign_lock_key+0x133/0x150 kernel/locking/lockdep.c:1028
 register_lock_class+0xcc/0x2e0 kernel/locking/lockdep.c:1343
 __lock_acquire+0x10c/0x2de0 kernel/locking/lockdep.c:5162
 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
 __mutex_lock_common kernel/locking/rtmutex_api.c:561 [inline]
 mutex_lock_nested+0x55/0x1d0 kernel/locking/rtmutex_api.c:580
 dvb_frontend_release+0x1c2/0x4d0 drivers/media/dvb-core/dvb_frontend.c:2942
 __fput+0x41a/0xa70 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:618
 filp_close_sync+0x6e/0xa0 fs/open.c:1574
 close_files fs/file.c:572 [inline]
 put_files_struct+0x233/0x3c0 fs/file.c:584
 do_exit+0x6f0/0x2360 kernel/exit.c:977
 do_group_exit+0x22d/0x2f0 kernel/exit.c:1123
 get_signal+0x136a/0x1430 kernel/signal.c:3113
 arch_do_signal_or_restart+0xbb/0x860 arch/x86/kernel/signal.c:337
 __exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
 exit_to_user_mode_loop+0x10e/0x770 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
 do_syscall_64+0x336/0x540 arch/x86/entry/syscall_64.c:107
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4b782fa4ce
Code: Unable to access opcode bytes at 0x7f4b782fa4a4.
RSP: 002b:00007fff7964d238 EFLAGS: 00000246 ORIG_RAX: 00000000000000e6
RAX: fffffffffffffdfc RBX: 000055557d526500 RCX: 00007f4b782fa4ce
RDX: 00007fff7964d290 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007f4b785c7ea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000b2905
R13: 00007fff7964d3e0 R14: 00000000000b1d4c R15: 00007fff7964d3c0
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/12/04 23:16 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master 007722b8211f 3a4d724d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root INFO: trying to register non-static key in dvb_frontend_release
* Struck through repros no longer work on HEAD.