]> www.infradead.org Git - users/jedix/linux-maple.git/commit
debugfs: don't mess with bits in ->d_fsdata
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Jan 2025 08:06:48 +0000 (08:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 12:14:35 +0000 (13:14 +0100)
commit95688800eefe28240204c2a0dd2bca5bf5f7f1d9
treeeed5a9b86e31af03198bd5ec886928f8bc7d2c93
parent41a0ecc0997cd40d913cce18867efd1c34c64e28
debugfs: don't mess with bits in ->d_fsdata

The reason we need that crap is the dual use ->d_fsdata has there -
it's both holding a debugfs_fsdata reference after the first
debugfs_file_get() (actually, after the call of proxy ->open())
*and* it serves as a place to stash a reference to real file_operations
from object creation to the first open.  Oh, and it's triple use,
actually - that stashed reference might be to debugfs_short_fops.

Bugger that for a game of solidiers - just put the operations
reference into debugfs-private augmentation of inode.  And split
debugfs_full_file_operations into full and short cases, so that
debugfs_get_file() could tell one from another.

Voila - ->d_fsdata holds NULL until the first (successful) debugfs_get_file()
and a reference to struct debugfs_fsdata afterwards.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20250112080705.141166-4-viro@zeniv.linux.org.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/debugfs/file.c
fs/debugfs/inode.c
fs/debugfs/internal.h