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/[email protected] Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Al Viro <[email protected]> Cc: Ajay Kaher <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
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)