ocfs2-pin-owning-modules-for-open-debugfs-files.patch removed from -mm tree
The quilt patch titled
Subject: ocfs2: pin owning modules for open debugfs files
has been removed from the -mm tree. Its filename was
ocfs2-pin-owning-modules-for-open-debugfs-files.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Cen Zhang <[email protected]>
Subject: ocfs2: pin owning modules for open debugfs files
Date: Fri, 16 Oct 2026 09:17:13 +0800
The OCFS2 debugfs file operation tables do not set owner. The full debugfs proxy obtains real_fops with fops_get() at open and keeps it until final release. Without an owner, this does not acquire a reference to the module containing the table and its callbacks. Removing the debugfs entries does not drain retained open files.
An open connected_nodes file can therefore outlive ocfs2_nodemanager and make full_proxy_release() read real_fops->release from freed module memory. Heming also reproduced the issue with fs_state and asked for the other OCFS2 debugfs operation tables to be checked.
Set owner to THIS_MODULE in all eleven explicit debugfs operation
tables: five in ocfs2_nodemanager, four in ocfs2_dlm, and two in ocfs2. The existing debugfs get/put pair then holds the appropriate module until final release. Leave the open, read and release callbacks unchanged. The blockcheck table already sets owner through DEFINE_DEBUGFS_ATTRIBUTE(), so it needs no change.
The original controlled test used an unloadable OCFS2 module and case-local probe filters without changing the candidate open, unload or release logic. Closing a retained connected_nodes file after normal unload produced:
BUG: unable to handle page fault for address: fffffbfff804cfef Oops: Oops: 0000 [#1] SMP KASAN NOPTI RIP: 0010:full_proxy_release+0xbf/0x190 Call Trace: <TASK> __fput+0x39a/0xa60 fput_close_sync+0xff/0x200 __x64_sys_close+0x8c/0xf0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> Modules linked in: [last unloaded: ocfs2_nodemanager]
---
fs/ocfs2/cluster/heartbeat.c | 1 + fs/ocfs2/cluster/netdebug.c | 4 ++++ fs/ocfs2/dlm/dlmdebug.c | 5 +++++ fs/ocfs2/dlmglue.c | 2 ++ fs/ocfs2/super.c | 1 + 5 files changed, 13 insertions(+)
fs/ocfs2/cluster/heartbeat.c renamed from fs/ocfs2/cluster/heartbeat.c~ocfs2-pin-owning-modules-for-open-debugfs-files +1 -0
@@ -1447,6 +1447,7 @@ static ssize_t o2hb_debug_read(struct fi#endif /* CONFIG_DEBUG_FS */ static const struct file_operations o2hb_debug_fops = { + .owner =THIS_MODULE , .open = o2hb_debug_open, .release = o2hb_debug_release, .read = o2hb_debug_read,
fs/ocfs2/cluster/netdebug.c renamed from fs/ocfs2/cluster/netdebug.c~ocfs2-pin-owning-modules-for-open-debugfs-files +4 -0
@@ -183,6 +183,7 @@ static int nst_fop_release(struct inode }static const struct file_operations nst_seq_fops = { + .owner =THIS_MODULE , .open = nst_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -415,6 +416,7 @@ static int stats_fop_open(struct inode * }static const struct file_operations stats_seq_fops = { + .owner =THIS_MODULE , .open = stats_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -427,6 +429,7 @@ static int sc_fop_open(struct inode *ino }static const struct file_operations sc_seq_fops = { + .owner =THIS_MODULE , .open = sc_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -476,6 +479,7 @@ static ssize_t o2net_debug_read(struct f }static const struct file_operations nodes_fops = { + .owner =THIS_MODULE , .open = nodes_fop_open, .release = o2net_debug_release, .read = o2net_debug_read,
fs/ocfs2/dlm/dlmdebug.c renamed from fs/ocfs2/dlm/dlmdebug.c~ocfs2-pin-owning-modules-for-open-debugfs-files +5 -0
@@ -7,6 +7,7 @@* Copyright (C) 2004, 2008 Oracle. All rights reserved. */ +#include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/highmem.h>
@@ -339,6 +340,7 @@ static int debug_purgelist_open(struct i }static const struct file_operations debug_purgelist_fops = { + .owner =THIS_MODULE , .open = debug_purgelist_open, .release = debug_release, .read = debug_read,
@@ -394,6 +396,7 @@ static int debug_mle_open(struct inode * }static const struct file_operations debug_mle_fops = { + .owner =THIS_MODULE , .open = debug_mle_open, .release = debug_release, .read = debug_read,
@@ -601,6 +604,7 @@ static int debug_lockres_release(struct }static const struct file_operations debug_lockres_fops = { + .owner =THIS_MODULE , .open = debug_lockres_open, .release = debug_lockres_release, .read = seq_read,
@@ -791,6 +795,7 @@ static int debug_state_open(struct inode }static const struct file_operations debug_state_fops = { + .owner =THIS_MODULE , .open = debug_state_open, .release = debug_release, .read = debug_read,
fs/ocfs2/dlmglue.c renamed from fs/ocfs2/dlmglue.c~ocfs2-pin-owning-modules-for-open-debugfs-files +2 -0
@@ -7,6 +7,7 @@* Copyright (C) 2003, 2004 Oracle. All rights reserved. */ +#include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/highmem.h>
@@ -3332,6 +3333,7 @@ static int ocfs2_dlm_debug_open(struct i }static const struct file_operations ocfs2_dlm_debug_fops = { + .owner =THIS_MODULE , .open = ocfs2_dlm_debug_open, .release = ocfs2_dlm_debug_release, .read = seq_read,
fs/ocfs2/super.c renamed from fs/ocfs2/super.c~ocfs2-pin-owning-modules-for-open-debugfs-files +1 -0
@@ -387,6 +387,7 @@ static ssize_t ocfs2_debug_read(struct f#endif /* CONFIG_DEBUG_FS */ static const struct file_operations ocfs2_osb_debug_fops = { + .owner =THIS_MODULE , .open = ocfs2_osb_debug_open, .release = ocfs2_debug_release, .read = ocfs2_debug_read,
_
Patches currently in -mm which might be from [email protected] are