Skip to content

Commit 4fa4b01

Browse files
torvaldsrostedt
authored andcommitted
eventfs: Initialize the tracefs inode properly
The tracefs-specific fields in the inode were not initialized before the inode was exposed to others through the dentry with 'd_instantiate()'. Move the field initializations up to before the d_instantiate. Link: https://lore.kernel.org/linux-trace-kernel/20240131185512.478449628@goodmis.org Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Ajay Kaher <ajay.kaher@broadcom.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202401291043.e62e89dc-oliver.sang@intel.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent d81786f commit 4fa4b01

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/tracefs/event_inode.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent
370370

371371
ti = get_tracefs(inode);
372372
ti->flags |= TRACEFS_EVENT_INODE;
373+
/* Only directories have ti->private set to an ei, not files */
374+
ti->private = ei;
373375

374376
inc_nlink(inode);
375377
d_instantiate(dentry, inode);
@@ -515,7 +517,6 @@ create_file_dentry(struct eventfs_inode *ei, int idx,
515517
static void eventfs_post_create_dir(struct eventfs_inode *ei)
516518
{
517519
struct eventfs_inode *ei_child;
518-
struct tracefs_inode *ti;
519520

520521
lockdep_assert_held(&eventfs_mutex);
521522

@@ -525,9 +526,6 @@ static void eventfs_post_create_dir(struct eventfs_inode *ei)
525526
srcu_read_lock_held(&eventfs_srcu)) {
526527
ei_child->d_parent = ei->dentry;
527528
}
528-
529-
ti = get_tracefs(ei->dentry->d_inode);
530-
ti->private = ei;
531529
}
532530

533531
/**

0 commit comments

Comments
 (0)