[BUG] ocfs2: non-static lock key warning in ocfs2_dlm_shutdown on crafted readonly image

From: ZW Tang

Date: Sun Aug 30 2026 - 23:39:11 EST


Hi,

I am reporting a lockdep warning triggered by a syzkaller reproducer on
Linux 7.2.0-rc3. A similar issue has been reported before, but I can still
reproduce this warning on Linux 7.2.0-rc3 with HEAD commit
1137d8b5df06137fb49513cc923b3b24d94cb809.

The reproducer mounts a crafted OCFS2 filesystem image through a loop
device. The image reports block check CRC errors, and the loop device is
detected as readonly. OCFS2 mounts the image in local mode and skips
cluster recovery. During unmount, ocfs2_dlm_shutdown() drops DLM lock
resources and reaches ocfs2_mark_lockres_freeing(), where lockdep reports
that a non-static key is being registered.

This looks like an OCFS2 shutdown-path issue for a partially initialized
or corrupted readonly mount. A lock resource appears to be dropped during
ocfs2_dlm_shutdown(), but its lockdep state/class is not initialized in a
way that lockdep can track.

Reproducer:

syz reproducer: https://pastebin.com/raw/TYgtTYYu
console output: https://pastebin.com/raw/pU2bSEGZ
kernel config: https://pastebin.com/raw/y7Hyukfc

Kernel:

HEAD commit: 1137d8b5df06137fb49513cc923b3b24d94cb809
git tree: torvalds/linux
kernel version: 7.2.0-rc3 #1 PREEMPT(full) (QEMU Ubuntu 24.10)

Relevant log:

loop0: detected capacity change from 0 to 32768

ocfs2_block_check_validate:400 ERROR: CRC32 failed:
stored: 0xb3775c19, computed 0x2dd1c265. Applying ECC.

ocfs2: Readonly device (7,0) detected. Cluster services will not be used
for this mount. Recovery will be skipped.

ocfs2: Mounting device (7,0) on (node local, slot 65535) with ordered data mode.

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: 1 UID: 0 PID: 10387 Comm: syz-executor Not tainted 7.2.0-rc3 #1
PREEMPT(full)

Call Trace:
<TASK>
dump_stack_lvl+0x116/0x1b0
register_lock_class+0x778/0x7c0
__lock_acquire+0xa4/0x27a0
lock_acquire+0x1a4/0x350
_raw_spin_lock_irqsave+0x3d/0x60
ocfs2_mark_lockres_freeing+0xb4/0x5a0
ocfs2_simple_drop_lockres+0x1e/0x80
ocfs2_dlm_shutdown+0x43/0x250
ocfs2_dismount_volume+0x33b/0xa70
generic_shutdown_super+0x166/0x400
kill_block_super+0x3b/0x90
deactivate_locked_super+0xbb/0x130
deactivate_super+0xb1/0xd0
cleanup_mnt+0x378/0x510
task_work_run+0x172/0x280
exit_to_user_mode_loop+0x201/0x660
do_syscall_64+0x5ba/0x7a0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>

ocfs2: Unmounting device (7,0) on (node local)