diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-02-25 15:34:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-02 11:38:17 +0100 |
commit | be16d365f4ae19dc6e8ade01b7b9812ae142458e (patch) | |
tree | 1f43185644c5c830faba0e397496c85ce07a2ed5 /fs/tracefs | |
parent | ebc465e894890a534ce05e035eae4829a2a47ba1 (diff) | |
download | linux-stable-be16d365f4ae19dc6e8ade01b7b9812ae142458e.tar.gz linux-stable-be16d365f4ae19dc6e8ade01b7b9812ae142458e.tar.bz2 linux-stable-be16d365f4ae19dc6e8ade01b7b9812ae142458e.zip |
tracefs: Set the group ownership in apply_options() not parse_options()
commit 851e99ebeec3f4a672bb5010cf1ece095acee447 upstream.
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/
Link: https://lkml.kernel.org/r/20220225153426.1c4cab6b@gandalf.local.home
Cc: stable@vger.kernel.org
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/tracefs')
-rw-r--r-- | fs/tracefs/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 8834819c0791..01b0eec4140d 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -265,7 +265,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)) @@ -292,7 +291,9 @@ static int tracefs_apply_options(struct super_block *sb) inode->i_mode |= opts->mode; inode->i_uid = opts->uid; - inode->i_gid = opts->gid; + + /* Set all the group ids to the mount option */ + set_gid(sb->s_root, opts->gid); return 0; } |