Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793217066; b=SX+SSAKcvAlSBH6Amm+fwLd/lfRe9hy56nNwUglybp5Thh2t++Agz93c5NY7m0u2BtOa dhKkBtEoeFZjFct4DMpCk4nyt0PUqLyjhhVWDayXNgcTZxHMHPciwAtZiK8itoqC7vrEG yb7VkInVLXwlgz4sPeEL/T7nL/zReUOYrdJ781kDinatawsAhScGmalfQXzUFCM7ZrH7k 7OcLIfLyNFqpjbBD3PbY5RbYhK3sBDfqbdrw426vGWtgNz5t2oQv/e9AapJvWH8Dbmh2X 8/m5yVtEVeX1RYXs7zm3hvGdeGL4rTza8XJ98HFtqnpnNPfAwm2yQ/nfYr0TUJ1zlTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793217066; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=QBdmWyZ6sTXb7cblZACdlmorOwxmWWVtIwbd/TnxerI=; b=PL94uSQ+xI8Rj0CP5NV94tLpQ/dNSPnX9LhWM5aUjPPMtU4jdQROEV8CphuCGOkjX6s4 V+zcr9Igi4iDlzgDfgjUJLDYZERfNZNNGWWBBUpqc07OcCw3oSCOCsc3KaRDw8JcepTqm qk0+yaw/57NildZWl2UW3yE0wcatDSPMKXaSm19EIiciQgbcRbBlKJKDgoBC4xByUV4T2 d4UMeCNE765jkD+RyMbz9RanczuBOu7eGU3XYLx0flMA7y8iBxzubQ8GzBCVyYm9mMO29 4J0ZfjqYUwD8OmZ10y8W1r63fazhm2eDBUlWHtkEVQ6QDjkKFr/zNLEnXqcBkiYN5Ww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zB+YvfCk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AF0F606A31A; Wed, 28 Oct 2026 19:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zB+YvfCk Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEF671F01825; Wed, 28 Oct 2026 19:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793217065; bh=QBdmWyZ6sTXb7cblZACdlmorOwxmWWVtIwbd/TnxerI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zB+YvfCkC0sEzO2B+DwjriD9FHSx+FdxLSzu6gwnofQSDE3DeHlCA8nzUm+vO6E/2 DWivH1tKMD07546NCQwLpkRoCXVppg/7301IRYtofgdhMR45frzspVfrY60iDZhemk rp/7Ici31PdKEyIi6vb4uPNWwc2WkNzMLnrtu29I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jacob Shivers , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Namjae Jeon , Paulo Alcantara Subject: [PATCH 6.1 1775/1887] smb: client: fix multiuser mount with krb5 Date: Wed, 28 Oct 2026 18:04:31 +0100 Message-ID: <20261028170539.843005411@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170459.200466217@linuxfoundation.org> References: <20261028170459.200466217@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paulo Alcantara commit 69499395867332364ed4ac8b546537eb3bab6ebb upstream. Customer reported that they could no longer mount their SMB shares with multiuser mount option and krb5. Turned out that the client wasn't duplicating username option when creating multiuser connections, therefore failing to retrieve credentials as cifs.upcall(8) couldn't find them in keytab. Fix this by duplicating username option (if set) from original fs context before creating multiuser connections with krb5. Reproducer: ``` $ ktutil ktutil: add_entry -password -p testuser -k 1 -e aes256-cts Password for testuser@ZELDA.TEST: ktutil: write_kt /etc/krb5.keytab ktutil: quit $ klist -ke Keytab name: FILE:/etc/krb5.keytab KVNO Principal ---- ---------------------------------------------------------------- 1 testuser@ZELDA.TEST (aes256-cts-hmac-sha1-96) $ mount.cifs //w22-root2/scratch /mnt/1 -o \ uid=1000,sec=krb5,username=testuser@ZELDA.TEST,multiuser mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) ``` Reported-by: Jacob Shivers Fixes: 12b4c5d98cd7 ("smb: client: fix krb5 mount with username option") Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Tom Talpey Cc: Bharath SM Cc: Namjae Jeon Cc: stable@vger.kernel.org Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/connect.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -4357,14 +4357,25 @@ cifs_setup_session(const unsigned int xi return rc; } -static int -cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses) +static int set_fs_context_auth(struct smb3_fs_context *ctx, + struct cifs_ses *ses) { ctx->sectype = ses->sectype; - /* krb5 is special, since we don't need username or pw */ - if (ctx->sectype == Kerberos) + /* + * krb5 is special as we might need to pass username (passwordless) down + * to cifs.upcall(8) for keytab. + */ + if (ctx->sectype == Kerberos) { + if (ses->user_name && ses->user_name[0]) { + ctx->username = kstrndup(ses->user_name, + CIFS_MAX_USERNAME_LEN, + GFP_KERNEL); + if (!ctx->username) + return -ENOMEM; + } return 0; + } return cifs_set_cifscreds(ctx, ses); } @@ -4401,7 +4412,7 @@ cifs_construct_tcon(struct cifs_sb_info ctx->seal = master_tcon->seal; ctx->witness = master_tcon->use_witness; - rc = cifs_set_vol_auth(ctx, master_tcon->ses); + rc = set_fs_context_auth(ctx, master_tcon->ses); if (rc) { tcon = ERR_PTR(rc); goto out;