[PATCH] cifs: reinstate original behavior again for forceuid/forcegid

Tom Talpey tom at talpey.com
Thu Apr 6 14:31:09 UTC 2023


On 4/6/2023 8:02 AM, Takayuki Nagata wrote:
> forceuid/forcegid should be enabled by default when uid=/gid= options are
> specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api")
> changed the behavior. This patch reinstates original behavior to overriding
> uid/gid with specified uid/gid.
> 
> Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")

This looks correct, but I'd love to hear Ronnie's call. Looking at
that commit, was it simply an oversight to set override_{uid,gid}?
It kind of looks that way, but...

Tom.

> Signed-off-by: Takayuki Nagata <tnagata at redhat.com>
> ---
>   fs/cifs/fs_context.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
> index ace11a1a7c8a..6f7c5ca3764f 100644
> --- a/fs/cifs/fs_context.c
> +++ b/fs/cifs/fs_context.c
> @@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
>   			goto cifs_parse_mount_err;
>   		ctx->linux_uid = uid;
>   		ctx->uid_specified = true;
> +		ctx->override_uid = 1;
>   		break;
>   	case Opt_cruid:
>   		uid = make_kuid(current_user_ns(), result.uint_32);
> @@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
>   			goto cifs_parse_mount_err;
>   		ctx->linux_gid = gid;
>   		ctx->gid_specified = true;
> +		ctx->override_gid = 1;
>   		break;
>   	case Opt_port:
>   		ctx->port = result.uint_32;



More information about the samba-technical mailing list