mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
eventfs: Initialize ei->children and ei->list in init_ei()
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: 5790b1fb3d ("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>
This commit is contained in:
committed by
Steven Rostedt
parent
372f853424
commit
1704aaaf5d
@@ -438,6 +438,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;
|
||||
}
|
||||
|
||||
@@ -729,8 +731,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);
|
||||
|
||||
scoped_guard(mutex, &eventfs_mutex) {
|
||||
if (!parent->is_freed)
|
||||
@@ -802,9 +802,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;
|
||||
|
||||
Reference in New Issue
Block a user