diff mbox series

cifs: Do not use the original cruid when following DFS links for multiuser mounts

Message ID 20210713022259.2968733-1-lsahlber@redhat.com
State New
Headers show
Series cifs: Do not use the original cruid when following DFS links for multiuser mounts | expand

Commit Message

Ronnie Sahlberg July 13, 2021, 2:22 a.m. UTC
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213565

cruid should only be used for the initial mount and after this we should use the current
users credentials.
Ignore the original cruid mount argument when creating a new context for a multiuser mount
following a DFS link.

Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
Cc: stable@vger.kernel.org # 5.11
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/cifs_dfs_ref.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Steve French July 13, 2021, 4:58 a.m. UTC | #1
tentatively merged into cifs-2.6.git for-next pending testing

On Mon, Jul 12, 2021 at 9:23 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213565
>
> cruid should only be used for the initial mount and after this we should use the current
> users credentials.
> Ignore the original cruid mount argument when creating a new context for a multiuser mount
> following a DFS link.
>
> Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
> Cc: stable@vger.kernel.org # 5.11
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/cifs_dfs_ref.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index ec57cdb1590f..5c9a8778c99d 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -208,6 +208,10 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
>                 else
>                         noff = tkn_e - (sb_mountdata + off) + 1;
>
> +               if (strncasecmp(sb_mountdata + off, "cruid=", 6) == 0) {
> +                       off += noff;
> +                       continue;
> +               }
>                 if (strncasecmp(sb_mountdata + off, "unc=", 4) == 0) {
>                         off += noff;
>                         continue;
> --
> 2.30.2
>
Paulo Alcantara July 13, 2021, 3:36 p.m. UTC | #2
Ronnie Sahlberg <lsahlber@redhat.com> writes:

> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213565
>
> cruid should only be used for the initial mount and after this we should use the current
> users credentials.
> Ignore the original cruid mount argument when creating a new context for a multiuser mount
> following a DFS link.
>
> Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
> Cc: stable@vger.kernel.org # 5.11
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/cifs_dfs_ref.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
diff mbox series

Patch

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index ec57cdb1590f..5c9a8778c99d 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -208,6 +208,10 @@  char *cifs_compose_mount_options(const char *sb_mountdata,
 		else
 			noff = tkn_e - (sb_mountdata + off) + 1;
 
+		if (strncasecmp(sb_mountdata + off, "cruid=", 6) == 0) {
+			off += noff;
+			continue;
+		}
 		if (strncasecmp(sb_mountdata + off, "unc=", 4) == 0) {
 			off += noff;
 			continue;