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 49B6A340D97; Mon, 18 Aug 2025 14:02:45 +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=1755525766; cv=none; b=U9m6MwrY2KdJJ1YHGCY/KDKUQt4lMRlIXz6Zp+WK0Ycocdt86u5s03XFPfMtL2vWkqvsLK79M6kpWf/pnYbjbucdsnNQUkCDB7uZ2uvtWfqLcI62W3c4QOLUcCrZbgSZhEcd6VgLnZcmdlKKW9VDpwC1a2JPi1efFSQPy9KTQ78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755525766; c=relaxed/simple; bh=qrMI7EefYw5fLPcRw8r/mTOlXEf5ntqPUz0QyadS88w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GMTXN/xdsdw9LnS/WILoDAM/m/1pcSd1/ypf2ROAvB/fpKBQdGVOPP2PPCGCfYCD5D2OL8kEPwipDxG6y+v+61zkffvCLlYiXwpZsQJaqDagTsFLfZtISa0Jn3R+BDv8Q4xeNBmjnbf9AxzWczJurVGXhiGZWnF6r86x7jIRNfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S4S4f/Mg; 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="S4S4f/Mg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5811EC4CEEB; Mon, 18 Aug 2025 14:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755525765; bh=qrMI7EefYw5fLPcRw8r/mTOlXEf5ntqPUz0QyadS88w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4S4f/Mg7KhyUfa1w9GdYcLTtZ6FMVX6FAmMmv9Ds6GFAl8Nnv679OeDcwH0HgnHE eMfQ7fb7i7Oo1HruT+qADCX2CXWCRgnq5KNxzcUo4uBGMg+mi3cFJXRqI2EVGRRW65 CbD8Cga143+KRXdKzWJ6gRYtnGxTXZHqrOgUoOUU= 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 6.16 360/570] cifs: Fix calling CIFSFindFirst() for root path without msearch Date: Mon, 18 Aug 2025 14:45:47 +0200 Message-ID: <20250818124519.723476329@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818124505.781598737@linuxfoundation.org> References: <20250818124505.781598737@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 6.16-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/smb/client/cifssmb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c index 75142f49d65d..3b6bc53ee1c4 100644 --- a/fs/smb/client/cifssmb.c +++ b/fs/smb/client/cifssmb.c @@ -4020,6 +4020,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); @@ -4031,6 +4037,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