Skip to content

Commit

Permalink
eventfs: Fix failure path in eventfs_create_events_dir()
Browse files Browse the repository at this point in the history
The failure path of allocating ei goes to a path that dereferences ei.
Add another label that skips over the ei dereferences to do the rest of
the clean up.

Link: https://lore.kernel.org/all/[email protected]/
Link: https://lore.kernel.org/linux-trace-kernel/[email protected]

Cc: Masami Hiramatsu <[email protected]>
Cc: Mark Rutland <[email protected]>
Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode")
Reported-by: Julia Lawall <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
  • Loading branch information
rostedt committed Oct 20, 2023
1 parent b8a555d commit 7e8ad67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/tracefs/event_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry

ei = kzalloc(sizeof(*ei), GFP_KERNEL);
if (!ei)
goto fail;
goto fail_ei;

inode = tracefs_get_inode(dentry->d_sb);
if (unlikely(!inode))
Expand Down Expand Up @@ -781,6 +781,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
fail:
kfree(ei->d_children);
kfree(ei);
fail_ei:
tracefs_failed_creating(dentry);
return ERR_PTR(-ENOMEM);
}
Expand Down

0 comments on commit 7e8ad67

Please sign in to comment.