]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
debugfs: fix missing mutex_destroy() in short_fops case
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 Dec 2024 08:12:04 +0000 (08:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Jan 2025 15:20:11 +0000 (16:20 +0100)
we need that in ->real_fops == NULL, ->short_fops != NULL case

Fixes: 8dc6d81c6b2a "debugfs: add small file operations for most files"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20241229081223.3193228-1-viro@zeniv.linux.org.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/debugfs/inode.c

index 65e46c7b6bf19a831f75d079b359b31204aafe75..e752009de9292dbac2691b1ccc2bdfe379b2e52e 100644 (file)
@@ -229,7 +229,7 @@ static void debugfs_release_dentry(struct dentry *dentry)
                return;
 
        /* check it wasn't a dir (no fsdata) or automount (no real_fops) */
-       if (fsd && fsd->real_fops) {
+       if (fsd && (fsd->real_fops || fsd->short_fops)) {
                WARN_ON(!list_empty(&fsd->cancellations));
                mutex_destroy(&fsd->cancellations_mtx);
        }