Skip to content

Commit a9de4eb

Browse files
committed
eventfs: Fix WARN_ON() in create_file_dentry()
As the comment right above a WARN_ON() in create_file_dentry() states: * Note, with the mutex held, the e_dentry cannot have content * and the ei->is_freed be true at the same time. But the WARN_ON() only has: WARN_ON_ONCE(ei->is_free); Where to match the comment (and what it should actually do) is: dentry = *e_dentry; WARN_ON_ONCE(dentry && ei->is_free) Also in that case, set dentry to NULL (although it should never happen). Link: https://lore.kernel.org/linux-trace-kernel/20231024123628.62b88755@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") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 0f7f544 commit a9de4eb

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
@@ -264,8 +264,9 @@ create_file_dentry(struct eventfs_inode *ei, struct dentry **e_dentry,
264264
* Note, with the mutex held, the e_dentry cannot have content
265265
* and the ei->is_freed be true at the same time.
266266
*/
267-
WARN_ON_ONCE(ei->is_freed);
268267
dentry = *e_dentry;
268+
if (WARN_ON_ONCE(dentry && ei->is_freed))
269+
dentry = NULL;
269270
/* The lookup does not need to up the dentry refcount */
270271
if (dentry && !lookup)
271272
dget(dentry);

0 commit comments

Comments
 (0)