All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: khorenko@virtuozzo.com, Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 4/4] ms/eventfs: Initialize ei->children and ei->list in init_ei()
Date: Wed, 11 Nov 2026 20:40:29 +0000	[thread overview]
Message-ID: <010701a1cc573612-6a57373a-5398-486d-b081-bf641d993a73-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261111203529.363554-5-eva.kurchatova@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] tracefs: commit message blames eventfs_create_dir() instead of eventfs_create_events_dir()
--

commit 518d04c37ab25c6aa9068d020ccd9d857768cb9a
Author: Deepanshu Kartikey <kartikey406@gmail.com>

ms/eventfs: Initialize ei->children and ei->list in init_ei()

This patch moves the INIT_LIST_HEAD() calls for ei->children and ei->list
into init_ei(). Both eventfs_create_dir() and eventfs_create_events_dir()
then get initialized lists before any failure path can reach free_ei().

Link: https://patch.msgid.link/20260824144653.54044-1-kartikey406@gmail.com

> ms/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.

[Severity: Low]
This isn't a code bug, but is the commit message naming the right function?

Before this patch, eventfs_create_dir() already ran INIT_LIST_HEAD() on
ei->children and ei->list right after alloc_ei() and the field
assignments:

    ei = alloc_ei(name);
    if (!ei)
        return ERR_PTR(-ENOMEM);

    ei->entries = entries;
    ei->nr_entries = size;
    ei->data = data;
    INIT_LIST_HEAD(&ei->children);
    INIT_LIST_HEAD(&ei->list);

The only later cleanup_ei() call in that function comes after
list_add_tail() and list_empty(), so the lists were already initialized
there.

The path that could reach free_ei() with uninitialized (zeroed) list heads
is the failure path in eventfs_create_events_dir():

    ei = alloc_root_ei(name);
    if (!ei)
        goto fail;

    inode = tracefs_get_inode(dentry->d_sb);
    if (unlikely(!inode))
        goto fail;
    ...
 fail:
    cleanup_ei(ei);

Here the INIT_LIST_HEAD() calls ran only after those failure points.

Could the commit message be reworded to name eventfs_create_events_dir()
as the function that hit the false warning? The code change itself looks
correct, since it covers both callers.

> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -444,6 +444,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;
>  }
>  

[ ... ]

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261111203529.363554-1-eva.kurchatova@virtuozzo.com?part=4

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

      reply	other threads:[~2026-11-11 20:41 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 ` [Devel] [PATCH hci-8.1 4/4] ms/eventfs: Initialize ei->children and ei->list in init_ei() Eva Kurchatova
2026-11-11 20:40   ` no-reply [this message]

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=010701a1cc573612-6a57373a-5398-486d-b081-bf641d993a73-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=eva.kurchatova@virtuozzo.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.