From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 4/4] ms/eventfs: Initialize ei->children and ei->list in init_ei()
Date: Wed, 11 Nov 2026 22:34:20 +0200 [thread overview]
Message-ID: <20261111203529.363554-5-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20261111203529.363554-1-eva.kurchatova@virtuozzo.com>
From: Deepanshu Kartikey <kartikey406@gmail.com>
eventfs_create_dir() allocates the eventfs_inode and initializes it with
init_ei(). But this does not initialize the eventfs_inode list_heads. If
the eventfs_create_dir() fails due to memory pressure, it will call
free_ei() before it initialized the lists, and that checks to make sure
the eventfs_inode has no children. But because the list wasn't
initialized, it will give a false warning.
Fix it by moving the list initialization into init_ei().
Cc: stable@vger.kernel.org
Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Reported-by: syzbot+3ef80b4ed02226d04a06@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3ef80b4ed02226d04a06
Link: https://patch.msgid.link/20260824144653.54044-1-kartikey406@gmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
[ Rewrote change log ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
(cherry picked from commit 1704aaaf5d22bc765c168402350d191e24e245bc)
https://virtuozzo.atlassian.net/browse/VSTOR-154529
Feature: fix ms/tracefs
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
fs/tracefs/event_inode.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index fbaa64e482e0..ca6e0a653efa 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -446,6 +446,8 @@ static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char
if (!ei->name)
return NULL;
kref_init(&ei->kref);
+ INIT_LIST_HEAD(&ei->children);
+ INIT_LIST_HEAD(&ei->list);
return ei;
}
@@ -753,8 +755,6 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
ei->entries = entries;
ei->nr_entries = size;
ei->data = data;
- INIT_LIST_HEAD(&ei->children);
- INIT_LIST_HEAD(&ei->list);
mutex_lock(&eventfs_mutex);
if (!parent->is_freed)
@@ -826,9 +826,6 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
ei->attr.uid = uid;
ei->attr.gid = gid;
- INIT_LIST_HEAD(&ei->children);
- INIT_LIST_HEAD(&ei->list);
-
ti = get_tracefs(inode);
ti->flags |= TRACEFS_EVENT_INODE;
ti->private = ei;
--
2.56.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-11 20:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 20:34 [Devel] [PATCH hci-8.1 0/4] ms/eventfs: fix kernel panic on NULL dereference Eva Kurchatova
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 1/4] ms/eventfs: Fix use-after-free in eventfs_remove_rec() Eva Kurchatova
2026-11-11 20:39 ` no-reply
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 2/4] ms/eventfs: Use children field for rcu head and add memory barriers Eva Kurchatova
2026-11-11 20:40 ` no-reply
2026-11-11 20:34 ` [Devel] [PATCH hci-8.1 3/4] ms/eventfs: fix SRCU read lock leak in eventfs_iterate() Eva Kurchatova
2026-11-11 20:39 ` no-reply
2026-11-11 20:34 ` Eva Kurchatova [this message]
2026-11-11 20:40 ` [Devel] [PATCH hci-8.1 4/4] ms/eventfs: Initialize ei->children and ei->list in init_ei() no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111203529.363554-5-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox