[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240903155825.2ec26f1a@gandalf.local.home>
Date: Tue, 3 Sep 2024 15:58:25 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Chi Zhiling <chizhiling@....com>
Cc: mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org, Chi
Zhiling <chizhiling@...inos.cn>
Subject: Re: [PATCH v2] eventfs: fix a null pointer access in
eventfs_iterate
On Thu, 29 Aug 2024 16:50:25 +0800
Chi Zhiling <chizhiling@....com> wrote:
> ---
> fs/tracefs/event_inode.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 01e99e98457d..18aae67704dc 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -642,6 +642,12 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
> /* Subtract the skipped entries above */
> c -= min((unsigned int)c, (unsigned int)ei->nr_entries);
>
> + mutex_lock(&eventfs_mutex);
> + if (ei->is_freed) {
> + mutex_unlock(&eventfs_mutex);
> + goto out;
> + }
> +
> list_for_each_entry_srcu(ei_child, &ei->children, list,
> srcu_read_lock_held(&eventfs_srcu)) {
>
> @@ -659,9 +665,12 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
>
> ino = eventfs_dir_ino(ei_child);
>
> - if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR))
> + if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) {
> + mutex_unlock(&eventfs_mutex);
> goto out_dec;
> + }
> }
> + mutex_unlock(&eventfs_mutex);
> ret = 1;
> out:
> srcu_read_unlock(&eventfs_srcu, idx);
> --
Nope, still not correct. See my reply to v1.
Thanks!
-- Steve
Powered by blists - more mailing lists