]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
debugfs: Convert to new uid/gid option parsing helpers
authorEric Sandeen <sandeen@redhat.com>
Fri, 28 Jun 2024 00:29:46 +0000 (19:29 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:46 +0000 (16:33 +0200)
[ Upstream commit 49abee5991e18f14ec822ef53acd173ae58ff594 ]

Convert to new uid/gid option parsing helpers

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Link: https://lore.kernel.org/r/b2f44ee0-3cee-49eb-a416-f26a9306eb56@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: 3a987b88a425 ("debugfs show actual source in /proc/mounts")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/debugfs/inode.c

index 8fd928899a59e47b69cab5c69f00c4fa81a32827..91521576f5003efb71a2d715a912852ae99b1c91 100644 (file)
@@ -92,9 +92,9 @@ enum {
 };
 
 static const struct fs_parameter_spec debugfs_param_specs[] = {
-       fsparam_u32     ("gid",         Opt_gid),
+       fsparam_gid     ("gid",         Opt_gid),
        fsparam_u32oct  ("mode",        Opt_mode),
-       fsparam_u32     ("uid",         Opt_uid),
+       fsparam_uid     ("uid",         Opt_uid),
        {}
 };
 
@@ -102,8 +102,6 @@ static int debugfs_parse_param(struct fs_context *fc, struct fs_parameter *param
 {
        struct debugfs_fs_info *opts = fc->s_fs_info;
        struct fs_parse_result result;
-       kuid_t uid;
-       kgid_t gid;
        int opt;
 
        opt = fs_parse(fc, debugfs_param_specs, param, &result);
@@ -120,16 +118,10 @@ static int debugfs_parse_param(struct fs_context *fc, struct fs_parameter *param
 
        switch (opt) {
        case Opt_uid:
-               uid = make_kuid(current_user_ns(), result.uint_32);
-               if (!uid_valid(uid))
-                       return invalf(fc, "Unknown uid");
-               opts->uid = uid;
+               opts->uid = result.uid;
                break;
        case Opt_gid:
-               gid = make_kgid(current_user_ns(), result.uint_32);
-               if (!gid_valid(gid))
-                       return invalf(fc, "Unknown gid");
-               opts->gid = gid;
+               opts->gid = result.gid;
                break;
        case Opt_mode:
                opts->mode = result.uint_32 & S_IALLUGO;