Skip to content

Commit 7e8ad67

Browse files
committed
eventfs: Fix failure path in eventfs_create_events_dir()
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/70e7bace-561c-95f-1117-706c2c220bc@inria.fr/ Link: https://lore.kernel.org/linux-trace-kernel/20231019204132.6662fef0@gandalf.local.home Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: Julia Lawall <julia.lawall@inria.fr> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent b8a555d commit 7e8ad67

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/tracefs/event_inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
735735

736736
ei = kzalloc(sizeof(*ei), GFP_KERNEL);
737737
if (!ei)
738-
goto fail;
738+
goto fail_ei;
739739

740740
inode = tracefs_get_inode(dentry->d_sb);
741741
if (unlikely(!inode))
@@ -781,6 +781,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
781781
fail:
782782
kfree(ei->d_children);
783783
kfree(ei);
784+
fail_ei:
784785
tracefs_failed_creating(dentry);
785786
return ERR_PTR(-ENOMEM);
786787
}

0 commit comments

Comments
 (0)