From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796385188; b=1Wtps3CpoOw8vjAHKbX7a2Xyg9q4KNIxptODNs9zMiljXcdAB+neYemH9oCNyiMU3eyY unDhHmM7Y7AXXNZWMNhVouGHDhPSh5rZBiPQl3v879iwRukEXAs9iCBjlpDludHKZC5No 2cOZNQ42LkwNhs6lx8Zu5lav7ELjEIV2U8mRX+fJFHCVIOQhOQvyWiyaUR6nZrVipWQk9 WpKj9KWOi3daUxtQ1w+wp5uHq4yvU+QhmeGs5qmJ3A43Tkh7S7BVtWhlDxvlVmQWOtMXp a1nHfaeONcwyviBCdv4XHVPLrLyekvE4eZ5/KktWd6x3+uVfu7Twil9NUowPe7ccMpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385188; 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=ju+WY4DzMlkYAsZoBG8jz+PPETEXAGyj/LZs3IOfwzk=; b=BkcM8wFXuCQ0qgVgkQuYEjBSzJZfmB1BNjsPlndTZAhJohLPjm/T0tB74MGqlwvrjpSa UUCFW1ZKz3J7Jx2azRYFQqJHzcnzeI3i4TIcKCR+8jnvAZFmPlOAvZDmhhdREnEk5xEYH mXt10C5ds3PKtSklDFfbQM50qBDOw0nJaGTYSuHrbkeDP8H374lC7Gsw4eKUuHI1KbKZ1 lKro2xZ3JGmUvWDdbqr4jzvRVpzLbn4OgMHyLQTzeJhD1o/tG0/PJ2wROpNTw2SA9U67d +1q4BLwHx8XCRz0+d8H/7qUM80+qQRE2u/tlRSIWWgNTFC1gk0ZpuvwErkAPisVR0kA== 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=dZWoOe8a; 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 06D41606A322; Fri, 4 Dec 2026 11:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dZWoOe8a Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72E1B1F000C2; Fri, 4 Dec 2026 11:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385187; bh=ju+WY4DzMlkYAsZoBG8jz+PPETEXAGyj/LZs3IOfwzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dZWoOe8amDi76FJW7HNXB7aG7T5jry2Dq64kfq4P+lDr7QhNcWdjwDIlDzuxq+xHC FVVu2kMRVj0dgawLRrikm/zzYaQSy3XNcMJVmGxHd7aY3bvjAo/52Qzwq0aEOmjElc TYsohNyGo3jQ7dEzdD1kjb6MrIMmgJVUpK2r9HJ0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dairui Zhang , Namjae Jeon , Sasha Levin Subject: [PATCH 6.6 0453/1167] ksmbd: fix durable reconnects for root shares Date: Fri, 4 Dec 2026 18:58:00 +0900 Message-ID: <20261204100713.811980122@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Namjae Jeon [ Upstream commit 25e36df831a47597c03c6239fbc71285e7d714c2 ] When a share exports "/", ksmbd_validate_name_reconnect() expects another slash after the share path. For a file at /foo, this rejects the valid reconnect name "foo" even though the file is in the share. Compare the requested name with the rendered file path after its leading slash when the resolved share root is "/". Keep the exact-root/empty-name check and reject rendered paths without an initial slash. Fixes: c8efcc786146 ("ksmbd: add support for durable handles v1/v2") Reported-by: Dairui Zhang Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin --- fs/smb/server/vfs_cache.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c index e2f7a7d9cca96..142aa00499805 100644 --- a/fs/smb/server/vfs_cache.c +++ b/fs/smb/server/vfs_cache.c @@ -1376,6 +1376,10 @@ int ksmbd_validate_name_reconnect(struct ksmbd_share_config *share, /* the durable fp is the share root itself */ if (name[0]) ret = -EINVAL; + } else if (share_path_sz == 1 && share_path[0] == '/') { + if (ab_pathname[0] != '/' || + strcmp(ab_pathname + 1, name)) + ret = -EINVAL; } else if (len <= share_path_sz || strncmp(ab_pathname, share_path, share_path_sz) || ab_pathname[share_path_sz] != '/' || -- 2.53.0