Commit d4e9a968 authored by Hao Ge's avatar Hao Ge Committed by Steven Rostedt (Google)

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: 8186fff7 ("tracefs/eventfs: Use root and instance inodes as default ownership")
Signed-off-by: default avatarHao Ge <gehao@kylinos.cn>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent e60b613d
...@@ -345,10 +345,9 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) ...@@ -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 * If the ei is being freed, the ownership of the children
* doesn't matter. * doesn't matter.
*/ */
if (ei->is_freed) { if (ei->is_freed)
ei = NULL; return NULL;
break;
}
// Walk upwards until you find the events inode // Walk upwards until you find the events inode
} while (!ei->is_events); } while (!ei->is_events);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment