[Devel] [PATCH hci-8.1] ms/tracefs: fix a leak in eventfs_create_events_dir()
Eva Kurchatova
eva.kurchatova at virtuozzo.com
Tue Nov 17 08:50:39 MSK 2026
From: Al Viro <viro at zeniv.linux.org.uk>
[ Upstream commit 798a401660a151633cb171738a72a8f1efb9b0b4 ]
If we have LOCKDOWN_TRACEFS, the function bails out - *after*
having locked the parent directory and without bothering to
undo that. Just check it before tracefs_start_creating()...
Fixes: e24709454c45 "tracefs/eventfs: Add missing lockdown checks"
Acked-by: Steven Rostedt (Google) <rostedt at goodmis.org>
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal at kernel.org>
(cherry picked from commit 3bcb274a192fc89a003a7808a877faf1f9a81ce3)
https://virtuozzo.atlassian.net/browse/VSTOR-155413
Feature: fix ms/tracefs
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
fs/tracefs/event_inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 357663cfd4ba..e060dfe7cdac 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -793,7 +793,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
const struct eventfs_entry *entries,
int size, void *data)
{
- struct dentry *dentry = tracefs_start_creating(name, parent);
+ struct dentry *dentry;
struct eventfs_root_inode *rei;
struct eventfs_inode *ei;
struct tracefs_inode *ti;
@@ -804,6 +804,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
if (security_locked_down(LOCKDOWN_TRACEFS))
return NULL;
+ dentry = tracefs_start_creating(name, parent);
if (IS_ERR(dentry))
return ERR_CAST(dentry);
--
2.56.1
More information about the Devel
mailing list