Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3883516pxv; Mon, 19 Jul 2021 11:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIp6yyYqllOq7nMBUnFHoIT6OvplqWAp9OC0LnaKvtSxho+HrNGK+YvI/4WE2Kl6gyn+yq X-Received: by 2002:a17:906:f145:: with SMTP id gw5mr27681001ejb.249.1626717823318; Mon, 19 Jul 2021 11:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626717823; cv=none; d=google.com; s=arc-20160816; b=o95lezZ2V/k5wm6SlnwmxtnDy5GA/z+OsRtgOn3ibF6Vahk/dXRn+tgJBzMIHYs24s HVoElZTtQj0M94AW+aV6RSYumu3VzdRyOqKDjDPiCKZ/N2qryMlxDeeaVvesF5dEfiV+ bL4h48cAHxxObIam61Nn7D4LOTo3ITqlw5GLJiDu03LuV9O1a0zEIK4XrRZnduYW1QHE yoMfuYOe6IR4cdO1SrQ0ivxZV3p+UjuJkrbdHcICLmaPLePLv3nFI7GKPAzN3PymmXZN vo2c5b7OSDq4TpC9KODPqW1p9FVZP0gAsPfIHz1qcNbDMxHD2mKNFx7UsFDVX1bG9CJ9 Vo0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mQYrczYhthEFQadE7QdC2Y32WmszcdwCnSHCNdniMv8=; b=zT24d8Fb5b1jZhpAZ+SL2GZ76OmGaSj9M/FfnFTXpv/5Ts3LMqKWqWZsEOYOMWKFiW W38rPqNoYIlQs1bYrRiat1WimundZmmGE5iH198R+isrHkeBuJmeJyYuoLVKJw3EDJBR Rt1NWyk1AwZ3sc6NF0JpH/jWtSepTDVJG05Fw9JZCR5fvBK6iH7xzh9yomKylWJFY83L A+c+PP/TR68GO98sdr/3W0Dtg1Dn2deX2CHH/zZCEdcgwq4A5RF7+lIKPWzamQg0p4Ba t+wktKU8fWTL3jYjAS9iucejhVIX4Ih+ReS07uobaDfgo/2k2TffSMtiJBcot3ARKOfP nHQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oQ9dMes3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si6704683eje.232.2021.07.19.11.03.20; Mon, 19 Jul 2021 11:03:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oQ9dMes3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354990AbhGSROb (ORCPT + 99 others); Mon, 19 Jul 2021 13:14:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235709AbhGSPhB (ORCPT ); Mon, 19 Jul 2021 11:37:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1BF9E606A5; Mon, 19 Jul 2021 16:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626711460; bh=+ICVfWQGiw/CqEw3V7m9n5QANmSfcNPfR7eNKcoAasM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQ9dMes3TCiAJg6QCt8gJNN3vvFT/q0j+LElp2fdw0x8dqf7DKokhJCpLN5OjPZmC +Iu8FKntyqxw4xhmG86NIrzGkVzebCUb9J9fePK7dIPaRPbTQGOCPluTj9tZ5NFC+I OHof8vi0jp+2zf/XkEk3B8KcMm0fFKoe5V5cejOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoli Feng , Ronnie Sahlberg , "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.12 003/292] cifs: Do not use the original cruid when following DFS links for multiuser mounts Date: Mon, 19 Jul 2021 16:51:05 +0200 Message-Id: <20210719144942.629302443@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.514164272@linuxfoundation.org> References: <20210719144942.514164272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronnie Sahlberg commit 50630b3f1ada0bf412d3f28e73bac310448d9d6f upstream. 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+ Reported-by: Xiaoli Feng Signed-off-by: Ronnie Sahlberg Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifs_dfs_ref.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c @@ -208,6 +208,10 @@ char *cifs_compose_mount_options(const c 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;