* [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
@ 2023-11-12 17:18 Steven Rostedt
2023-11-12 17:19 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-11-12 17:18 UTC (permalink / raw)
To: LKML, stable
Cc: Greg Kroah-Hartman, Masami Hiramatsu, Mark Rutland, Milian Wolff,
akaher, Andrew Morton
From: "Steven Rostedt (Google)" <rostedt@goodmis.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/
Fixes: 9aaee3eebc91 ("eventfs: Save ownership and mode")
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.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;
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
2023-11-12 17:18 [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr() Steven Rostedt
@ 2023-11-12 17:19 ` kernel test robot
2023-11-12 17:39 ` Steven Rostedt
2023-11-13 17:57 ` Milian Wolff
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-11-12 17:19 UTC (permalink / raw)
To: Steven Rostedt; +Cc: stable, oe-kbuild-all
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1
Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
Link: https://lore.kernel.org/stable/20231112121817.2713c150%40rorschach.local.home
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
2023-11-12 17:18 [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr() Steven Rostedt
2023-11-12 17:19 ` kernel test robot
@ 2023-11-12 17:39 ` Steven Rostedt
2023-11-13 17:57 ` Milian Wolff
2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2023-11-12 17:39 UTC (permalink / raw)
To: LKML, stable
Cc: Greg Kroah-Hartman, Masami Hiramatsu, Mark Rutland, Milian Wolff,
akaher, Andrew Morton
On Sun, 12 Nov 2023 12:18:17 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.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/
>
> Fixes: 9aaee3eebc91 ("eventfs: Save ownership and mode")
> Reported-by: Milian Wolff <milian.wolff@kdab.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
I guess I should have included the "Cc: stable" tag. This is a bit
different patch since it's not going to land in upstream, as the bug
doesn't exist there.
I can resend if needed.
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr()
2023-11-12 17:18 [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr() Steven Rostedt
2023-11-12 17:19 ` kernel test robot
2023-11-12 17:39 ` Steven Rostedt
@ 2023-11-13 17:57 ` Milian Wolff
2 siblings, 0 replies; 4+ messages in thread
From: Milian Wolff @ 2023-11-13 17:57 UTC (permalink / raw)
To: LKML, stable, Steven Rostedt
Cc: Greg Kroah-Hartman, Masami Hiramatsu, Mark Rutland, akaher,
Andrew Morton
On Sonntag, 12. November 2023 18:18:17 CET Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.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@kdab.com>
> Fixes: 9aaee3eebc91 ("eventfs: Save ownership and mode")
> Reported-by: Milian Wolff <milian.wolff@kdab.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.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@kdab.com | Senior Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-13 18:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-12 17:18 [v6.6][PATCH] eventfs: Check for NULL ef in eventfs_set_attr() Steven Rostedt
2023-11-12 17:19 ` kernel test robot
2023-11-12 17:39 ` Steven Rostedt
2023-11-13 17:57 ` Milian Wolff
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.