Re: [PATCH 02/14] autofs: Convert to new uid/gid option parsing helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/6/24 08:27, Eric Sandeen wrote:
Convert to new uid/gid option parsing helpers

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
---
  fs/autofs/inode.c | 16 ++++------------
  1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index 1f5db6863663..cf792d4de4f1 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -126,7 +126,7 @@ enum {
  const struct fs_parameter_spec autofs_param_specs[] = {
  	fsparam_flag	("direct",		Opt_direct),
  	fsparam_fd	("fd",			Opt_fd),
-	fsparam_u32	("gid",			Opt_gid),
+	fsparam_gid	("gid",			Opt_gid),
  	fsparam_flag	("ignore",		Opt_ignore),
  	fsparam_flag	("indirect",		Opt_indirect),
  	fsparam_u32	("maxproto",		Opt_maxproto),
@@ -134,7 +134,7 @@ const struct fs_parameter_spec autofs_param_specs[] = {
  	fsparam_flag	("offset",		Opt_offset),
  	fsparam_u32	("pgrp",		Opt_pgrp),
  	fsparam_flag	("strictexpire",	Opt_strictexpire),
-	fsparam_u32	("uid",			Opt_uid),
+	fsparam_uid	("uid",			Opt_uid),
  	{}
  };
@@ -193,8 +193,6 @@ static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param)
  	struct autofs_fs_context *ctx = fc->fs_private;
  	struct autofs_sb_info *sbi = fc->s_fs_info;
  	struct fs_parse_result result;
-	kuid_t uid;
-	kgid_t gid;
  	int opt;
opt = fs_parse(fc, autofs_param_specs, param, &result);
@@ -205,16 +203,10 @@ static int autofs_parse_param(struct fs_context *fc, struct fs_parameter *param)
  	case Opt_fd:
  		return autofs_parse_fd(fc, sbi, param, &result);
  	case Opt_uid:
-		uid = make_kuid(current_user_ns(), result.uint_32);
-		if (!uid_valid(uid))
-			return invalfc(fc, "Invalid uid");
-		ctx->uid = uid;
+		ctx->uid = result.uid;
  		break;
  	case Opt_gid:
-		gid = make_kgid(current_user_ns(), result.uint_32);
-		if (!gid_valid(gid))
-			return invalfc(fc, "Invalid gid");
-		ctx->gid = gid;
+		ctx->gid = result.gid;
  		break;
  	case Opt_pgrp:
  		ctx->pgrp = result.uint_32;


I like the idea and it looks just fine for autofs.

Acked-by: Ian Kent <raven@xxxxxxxxxx>


Ian






[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux