tracefs: Convert to new uid/gid option parsing helpers

Convert to new uid/gid option parsing helpers

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Link: https://lore.kernel.org/r/6c9b0b16-e61b-4dfc-852d-e2eb5bb11b82@redhat.com
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Eric Sandeen 2024-06-27 19:40:44 -05:00 committed by Christian Brauner
parent 3229e3a5a3
commit b548291690
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -296,9 +296,9 @@ enum {
}; };
static const struct fs_parameter_spec tracefs_param_specs[] = { static const struct fs_parameter_spec tracefs_param_specs[] = {
fsparam_u32 ("gid", Opt_gid), fsparam_gid ("gid", Opt_gid),
fsparam_u32oct ("mode", Opt_mode), fsparam_u32oct ("mode", Opt_mode),
fsparam_u32 ("uid", Opt_uid), fsparam_uid ("uid", Opt_uid),
{} {}
}; };
@ -306,8 +306,6 @@ static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param
{ {
struct tracefs_fs_info *opts = fc->s_fs_info; struct tracefs_fs_info *opts = fc->s_fs_info;
struct fs_parse_result result; struct fs_parse_result result;
kuid_t uid;
kgid_t gid;
int opt; int opt;
opt = fs_parse(fc, tracefs_param_specs, param, &result); opt = fs_parse(fc, tracefs_param_specs, param, &result);
@ -316,16 +314,10 @@ static int tracefs_parse_param(struct fs_context *fc, struct fs_parameter *param
switch (opt) { switch (opt) {
case Opt_uid: case Opt_uid:
uid = make_kuid(current_user_ns(), result.uint_32); opts->uid = result.uid;
if (!uid_valid(uid))
return invalf(fc, "Unknown uid");
opts->uid = uid;
break; break;
case Opt_gid: case Opt_gid:
gid = make_kgid(current_user_ns(), result.uint_32); opts->gid = result.gid;
if (!gid_valid(gid))
return invalf(fc, "Unknown gid");
opts->gid = gid;
break; break;
case Opt_mode: case Opt_mode:
opts->mode = result.uint_32 & S_IALLUGO; opts->mode = result.uint_32 & S_IALLUGO;