Skip to content

Commit 12c20c6

Browse files
minipli-ossrostedt
authored andcommitted
eventfs: Don't return NULL in eventfs_create_dir()
Commit 77a06c3 ("eventfs: Test for ei->is_freed when accessing ei->dentry") added another check, testing if the parent was freed after we released the mutex. If so, the function returns NULL. However, all callers expect it to either return a valid pointer or an error pointer, at least since commit 5264a2f ("tracing: Fix a NULL vs IS_ERR() bug in event_subsystem_dir()"). Returning NULL will therefore fail the error condition check in the caller. Fix this by substituting the NULL return value with a fitting error pointer. Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: [email protected] Fixes: 77a06c3 ("eventfs: Test for ei->is_freed when accessing ei->dentry") Link: https://lore.kernel.org/[email protected] Reviewed-by: Dan Carpenter <[email protected]> Reviewed-by: Ajay Kaher <[email protected]> Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 0df2ac5 commit 12c20c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/tracefs/event_inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
736736
/* Was the parent freed? */
737737
if (list_empty(&ei->list)) {
738738
cleanup_ei(ei);
739-
ei = NULL;
739+
ei = ERR_PTR(-EBUSY);
740740
}
741741
return ei;
742742
}

0 commit comments

Comments
 (0)