Skip to content

Commit d4e9a96

Browse files
GeHao01994rostedt
authored andcommitted
eventfs: Fix a possible null pointer dereference in eventfs_find_events()
In function eventfs_find_events,there is a potential null pointer that may be caused by calling update_events_attr which will perform some operations on the members of the ei struct when ei is NULL. Hence,When ei->is_freed is set,return NULL directly. Link: https://lore.kernel.org/linux-trace-kernel/20240513053338.63017-1-hao.ge@linux.dev Cc: stable@vger.kernel.org Fixes: 8186fff ("tracefs/eventfs: Use root and instance inodes as default ownership") Signed-off-by: Hao Ge <gehao@kylinos.cn> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent e60b613 commit d4e9a96

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fs/tracefs/event_inode.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,9 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry)
345345
* If the ei is being freed, the ownership of the children
346346
* doesn't matter.
347347
*/
348-
if (ei->is_freed) {
349-
ei = NULL;
350-
break;
351-
}
348+
if (ei->is_freed)
349+
return NULL;
350+
352351
// Walk upwards until you find the events inode
353352
} while (!ei->is_events);
354353

0 commit comments

Comments
 (0)