[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1978591.lLQaUkDWoz@milian-workstation>
Date: Mon, 13 Nov 2023 18:57:22 +0100
From: Milian Wolff <milian.wolff@...b.com>
To: LKML <linux-kernel@...r.kernel.org>,
stable <stable@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>, akaher@...are.com,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
On Sonntag, 12. November 2023 18:18:17 CET Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
>
> The top level events directory dentry does not have a d_fsdata set to a
> eventfs_file pointer. This dentry is still passed to eventfs_set_attr().
> It can not assume that the d_fsdata is set. Check for that.
>
> Link:
> https://lore.kernel.org/all/20231112104158.6638-1-milian.wolff@kdab.com/
Thanks you Steven,
this works like a charm.
Tested-by: Milian Wolff <milian.wolff@...b.com>
> Fixes: 9aaee3eebc91 ("eventfs: Save ownership and mode")
> Reported-by: Milian Wolff <milian.wolff@...b.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>
> ---
>
> Note: This only affects 6.6 as the code in 6.7 here was rewritten.
> I tested 6.7 and it does not have this bug.
>
> fs/tracefs/event_inode.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 5fcfb634fec2..efbdc47c74dc 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -113,14 +113,14 @@ static int eventfs_set_attr(struct mnt_idmap *idmap,
> struct dentry *dentry,
>
> mutex_lock(&eventfs_mutex);
> ef = dentry->d_fsdata;
> - if (ef->is_freed) {
> + if (ef && ef->is_freed) {
> /* Do not allow changes if the event is about to be
removed. */
> mutex_unlock(&eventfs_mutex);
> return -ENODEV;
> }
>
> ret = simple_setattr(idmap, dentry, iattr);
> - if (!ret)
> + if (!ret && ef)
> update_attr(ef, iattr);
> mutex_unlock(&eventfs_mutex);
> return ret;
--
Milian Wolff | milian.wolff@...b.com | Senior Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
Powered by blists - more mailing lists