[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240513053338.63017-1-hao.ge@linux.dev>
Date: Mon, 13 May 2024 13:33:38 +0800
From: hao.ge@...ux.dev
To: rostedt@...dmis.org,
mhiramat@...nel.org,
mathieu.desnoyers@...icios.com
Cc: linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
hao.ge@...ux.dev,
Hao Ge <gehao@...inos.cn>
Subject: [PATCH v2] eventfs: Fix a possible null pointer dereference in eventfs_find_events
From: Hao Ge <gehao@...inos.cn>
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.
Fixes: 8186fff7ab64 ("tracefs/eventfs: Use root and instance inodes as default ownership")
Signed-off-by: Hao Ge <gehao@...inos.cn>
---
v2:
- adjust title and commit message
- omit curly brackets
---
fs/tracefs/event_inode.c | 7 +++----
1 file 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);
--
2.25.1
Powered by blists - more mailing lists