From: Steve French <smfrench@gmail.com>
To: Paulo Alcantara <pc@manguebit.com>
Cc: linux-cifs@vger.kernel.org, Shane Nehring <snehring@iastate.edu>
Subject: Re: [PATCH 1/2] smb: client: set correct id, uid and cruid for multiuser automounts
Date: Sun, 11 Feb 2024 21:06:57 -0600 [thread overview]
Message-ID: <CAH2r5mvUeeNcd_eBQfCvKLdp3x0GycO17s2WSaGrWpa6dmBXHg@mail.gmail.com> (raw)
In-Reply-To: <20240211231931.185193-1-pc@manguebit.com>
tentatively merged these two into cifs-2.6.git for-next pending review
and testing
On Sun, Feb 11, 2024 at 5:20 PM Paulo Alcantara <pc@manguebit.com> wrote:
>
> When uid, gid and cruid are not specified, we need to set dynamically
> set them into the filesystem context used for automounting otherwise
> they'll end up reusing the values from the parent mount.
>
> Fixes: 9fd29a5bae6e ("cifs: use fs_context for automounts")
> Reported-by: Shane Nehring <snehring@iastate.edu>
> Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2259257
> Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
> ---
> fs/smb/client/namespace.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c
> index a6968573b775..4a517b280f2b 100644
> --- a/fs/smb/client/namespace.c
> +++ b/fs/smb/client/namespace.c
> @@ -168,6 +168,21 @@ static char *automount_fullpath(struct dentry *dentry, void *page)
> return s;
> }
>
> +static void fs_context_set_ids(struct smb3_fs_context *ctx)
> +{
> + kuid_t uid = current_fsuid();
> + kgid_t gid = current_fsgid();
> +
> + if (ctx->multiuser) {
> + if (!ctx->uid_specified)
> + ctx->linux_uid = uid;
> + if (!ctx->gid_specified)
> + ctx->linux_gid = gid;
> + }
> + if (!ctx->cruid_specified)
> + ctx->cred_uid = uid;
> +}
> +
> /*
> * Create a vfsmount that we can automount
> */
> @@ -205,6 +220,7 @@ static struct vfsmount *cifs_do_automount(struct path *path)
> tmp.leaf_fullpath = NULL;
> tmp.UNC = tmp.prepath = NULL;
> tmp.dfs_root_ses = NULL;
> + fs_context_set_ids(&tmp);
>
> rc = smb3_fs_context_dup(ctx, &tmp);
> if (rc) {
> --
> 2.43.0
>
--
Thanks,
Steve
prev parent reply other threads:[~2024-02-12 3:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-11 23:19 [PATCH 1/2] smb: client: set correct id, uid and cruid for multiuser automounts Paulo Alcantara
2024-02-11 23:19 ` [PATCH 2/2] smb: client: handle path separator of created SMB symlinks Paulo Alcantara
2024-02-12 3:06 ` Steve French [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH2r5mvUeeNcd_eBQfCvKLdp3x0GycO17s2WSaGrWpa6dmBXHg@mail.gmail.com \
--to=smfrench@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=snehring@iastate.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).