From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D7AE83568FC; Tue, 26 Aug 2025 14:17:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756217831; cv=none; b=nlQ5L+DKWTLZF4Hho161QVDJOdf5m6qK/tzZoLP6/wrBaOvXKh6ZPVyKd5ZhSL71KRczAAnFGaiUtQbev3kiwS9Lem9JtaB/yWaaPlCXoZgcQuSeesM5uJRmerbqTRxRXf4DLA7Vd/LTaQSzKuKqUTCQAIUXM+LA7ioc24/gOKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756217831; c=relaxed/simple; bh=mBfxcOAQX3qFlcB93nwgwTnQ0HI42trgc0otC1TNFdE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LrflTclN9HEm93dPBAXK0bKSJvYTpPS0XJtqqikXBqpS/8Ht0LmBF2SE7NFhKuNgnGsZl1UmK+DmVQit29HHG9v04Sxi/bAzrWPI1RjxIqYqzDVolK6/+UhuV3RoJTIWHDUW211CP8yJ0EogpS3sNIL4wf91z5a7BH+/KmHFa9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ncNby9Yb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ncNby9Yb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6665DC4CEF1; Tue, 26 Aug 2025 14:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756217831; bh=mBfxcOAQX3qFlcB93nwgwTnQ0HI42trgc0otC1TNFdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ncNby9Ybd2IxdMfZk3kkQWR1XcDJFsFn18cmRsJwobNwDU5Seoca1sZ5+cofEjmQh hAoDc1xGSbWZ0y6MmAO58ncupyVzyZOv+GRkU97ZRTYGorK76uZS8Q35qZfyQXpFqU IzzQ1Zldqt0Zcbx9oE8T4CCaPkc1a/afJRJs4jYY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Steve French , Sasha Levin Subject: [PATCH 5.10 291/523] cifs: Fix calling CIFSFindFirst() for root path without msearch Date: Tue, 26 Aug 2025 13:08:21 +0200 Message-ID: <20250826110931.624003049@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110924.562212281@linuxfoundation.org> References: <20250826110924.562212281@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pali Rohár [ Upstream commit b460249b9a1dab7a9f58483e5349d045ad6d585c ] To query root path (without msearch wildcard) it is needed to send pattern '\' instead of '' (empty string). This allows to use CIFSFindFirst() to query information about root path which is being used in followup changes. This change fixes the stat() syscall called on the root path on the mount. It is because stat() syscall uses the cifs_query_path_info() function and it can fallback to the CIFSFindFirst() usage with msearch=false. Signed-off-by: Pali Rohár Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/cifssmb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 95992c93bbe3..a19e5e7c7d0f 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -4470,6 +4470,12 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, pSMB->FileName[name_len] = 0; pSMB->FileName[name_len+1] = 0; name_len += 2; + } else if (!searchName[0]) { + pSMB->FileName[0] = CIFS_DIR_SEP(cifs_sb); + pSMB->FileName[1] = 0; + pSMB->FileName[2] = 0; + pSMB->FileName[3] = 0; + name_len = 4; } } else { name_len = copy_path_name(pSMB->FileName, searchName); @@ -4481,6 +4487,10 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, pSMB->FileName[name_len] = '*'; pSMB->FileName[name_len+1] = 0; name_len += 2; + } else if (!searchName[0]) { + pSMB->FileName[0] = CIFS_DIR_SEP(cifs_sb); + pSMB->FileName[1] = 0; + name_len = 2; } } -- 2.39.5