From nobody Thu Apr 2 15:37:26 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6F8A10FD; Wed, 11 Feb 2026 04:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770785885; cv=none; b=GWdKgtqhMqhL+J+aIMDCbP5mQf10RGKXEKVQrVKEDYibkZidCkFpGQwSQxyHh2quyQhQq+icHUGZkeuOJr/1mvsihwir+3ysH9FCxiFNKnBfPENujsioEqQjmQudJ66IK1AvaCV6Irp9hImJ7O3h/IWzXHd8QWOL7Zw+xr82dLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770785885; c=relaxed/simple; bh=+FA1W9Z2vbQjQK0j2jUNqimALwu8nHPzLir3ppUSooU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UbU09GZjNxWywvTemCaqoK9dqdWOikuF7SYcGyg1HkKqRiy3jOy0P491FLNMUEOwuAd5Z/XKHVDLKXQ+Eb7Arw8x8jqKY7/lH8iWOMTLDMSBOUdXodezw61xnanIDsKOFjJpEl9StknXeCmVtmhSS81Kvc5sv/92Bq9iM3I2/vE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=FFFcn8aI; arc=none smtp.client-ip=117.135.210.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="FFFcn8aI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=vq WDiSJjDTfe4TM7yCfDJmVRe3dt5YsEZvwC61BIbzM=; b=FFFcn8aIQ5YZNc43nB UvOdAmX8dG4VgmEon/K6ABR8cWMu75K+pKRaiG79lSqB+Cc3gPE+1r3ZVEnl8uOf evS3Qze9aZB1pdKhE4G55wA+9ohW9ccgGZxKfpziYrIuzEyL2XQt4aXjSpcWQxNY c7DSUjJy952bFWCkUUlcK6o7w= Received: from pek-lpg-core6.wrs.com (unknown []) by gzga-smtp-mtada-g0-0 (Coremail) with SMTP id _____wD3X6o0DIxpkN3MKg--.65390S2; Wed, 11 Feb 2026 12:57:24 +0800 (CST) From: Rahul Sharma To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Paulo Alcantara , Shane Nehring , Steve French , Rahul Sharma Subject: [PATCH 6.1.y] smb: client: set correct id, uid and cruid for multiuser automounts Date: Wed, 11 Feb 2026 12:57:21 +0800 Message-Id: <20260211045721.3672020-1-black.hawk@163.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3X6o0DIxpkN3MKg--.65390S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZFy5Gr4UZrWxJF1DXw18Zrb_yoW8ZFyxpr 4rCr1rGrs5XF17GanIy3WYqasxJryvyF1xG3y7C3s29a4DZ39xWanFqa12vFy8trWFqa4F qrWqyr429ay2yFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zEGQ6NUUUUU= X-CM-SenderInfo: 5eoduy4okd4yi6rwjhhfrp/xtbC3RWNJ2mMDDVe9wAA3X Content-Type: text/plain; charset="utf-8" From: Paulo Alcantara [ Upstream commit 4508ec17357094e2075f334948393ddedbb75157 ] When uid, gid and cruid are not specified, we need to 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 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=3D2259257 Cc: stable@vger.kernel.org # 6.2+ Signed-off-by: Paulo Alcantara (Red Hat) Signed-off-by: Steve French [ The context change is due to the commit 561f82a3a24c ("smb: client: rename cifs_dfs_ref.c to namespace.c") and the commit 0a049935e47e ("smb: client: get rid of dfs naming in automount code") in v6.6 which are irrelevant to the logic of this patch. ] Signed-off-by: Rahul Sharma --- fs/smb/client/cifs_dfs_ref.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/smb/client/cifs_dfs_ref.c b/fs/smb/client/cifs_dfs_ref.c index 876f9a43a99d..d8a20283de0d 100644 --- a/fs/smb/client/cifs_dfs_ref.c +++ b/fs/smb/client/cifs_dfs_ref.c @@ -283,6 +283,21 @@ static int set_dest_addr(struct smb3_fs_context *ctx, = const char *full_path) return rc; } =20 +static void fs_context_set_ids(struct smb3_fs_context *ctx) +{ + kuid_t uid =3D current_fsuid(); + kgid_t gid =3D current_fsgid(); + + if (ctx->multiuser) { + if (!ctx->uid_specified) + ctx->linux_uid =3D uid; + if (!ctx->gid_specified) + ctx->linux_gid =3D gid; + } + if (!ctx->cruid_specified) + ctx->cred_uid =3D uid; +} + /* * Create a vfsmount that we can automount */ @@ -333,6 +348,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct pa= th *path) tmp.source =3D full_path; tmp.UNC =3D tmp.prepath =3D NULL; =20 + fs_context_set_ids(&tmp); rc =3D smb3_fs_context_dup(ctx, &tmp); if (rc) { mnt =3D ERR_PTR(rc); --=20 2.34.1