From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH v2] tracefs: Set the group ownership in apply_options() not parse_options()
Date: Fri, 25 Feb 2022 15:32:32 -0500 [thread overview]
Message-ID: <20220225153232.26e0b335@gandalf.local.home> (raw)
In-Reply-To: <20220225152123.6c19adec@gandalf.local.home>
On Fri, 25 Feb 2022 15:21:23 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> Al Viro brought it to my attention that the dentries may not be filled
> when the parse_options() is called, causing the call to set_gid() to
> possibly crash. It should only be called if parse_options() succeeds
> totally anyway.
>
> He suggested the logical place to do the update is in apply_options().
>
> Link: https://lore.kernel.org/all/20220225165219.737025658@goodmis.org/
>
> Cc: stable@vger.kernel.org
> Reported-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: 48b27b6b5191 ("tracefs: Set all files to the same group ownership as the mount option")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> fs/tracefs/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
> index bafc02bf8220..3638d330ff5a 100644
> --- a/fs/tracefs/inode.c
> +++ b/fs/tracefs/inode.c
> @@ -264,7 +264,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
> if (!gid_valid(gid))
> return -EINVAL;
> opts->gid = gid;
> - set_gid(tracefs_mount->mnt_root, gid);
> break;
> case Opt_mode:
> if (match_octal(&args[0], &option))
> @@ -293,6 +292,9 @@ static int tracefs_apply_options(struct super_block *sb)
> inode->i_uid = opts->uid;
> inode->i_gid = opts->gid;
>
> + if (tracefs_mount && tracefs_mount->mnt_root)
> + set_gid(tracefs_mount->mnt_root, opts->gid);
Bah, I forgot the '-a' in 'git commit -a --amend'
Ignore this :-/
-- Steve
> +
> return 0;
> }
>
prev parent reply other threads:[~2022-02-25 20:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 20:21 Steven Rostedt
2022-02-25 20:32 ` Steven Rostedt [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=20220225153232.26e0b335@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®