diff options
author | Hao Ge <gehao@kylinos.cn> | 2024-05-13 07:33:38 +0200 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2024-05-14 17:13:45 +0200 |
commit | d4e9a968738bf66d3bb852dd5588d4c7afd6d7f4 (patch) | |
tree | 5e1870189a87134d79bad978cb24ac3a2360624b | |
parent | ftrace: Fix possible use-after-free issue in ftrace_location() (diff) | |
download | linux-d4e9a968738bf66d3bb852dd5588d4c7afd6d7f4.tar.xz linux-d4e9a968738bf66d3bb852dd5588d4c7afd6d7f4.zip |
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: 8186fff7ab64 ("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>
-rw-r--r-- | fs/tracefs/event_inode.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index a878cea70f4c..0256afdd4acf 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -345,10 +345,9 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) * If the ei is being freed, the ownership of the children * doesn't matter. */ - if (ei->is_freed) { - ei = NULL; - break; - } + if (ei->is_freed) + return NULL; + // Walk upwards until you find the events inode } while (!ei->is_events); |