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=1796388284; b=BetvsKErEq4J1QUZUM1xFaDISq/Km4vFQ7KY3Q99lpXuFYdrslnlYPAe5TfbRZovtwzR bbkiS4wbt1HYHS74efIgTouqBXQ3kyP8Zqgv+dlCSzfiu3HssrUw15qZUSgkV8L3ISX56 7VltqRBZovTq+Ex4nomDW/koNObsxW4CSomtHuJ/lZFLb3tXs9RS0U9FPuZFVueUeA6bE IARdrj2um78E+A9AwdBO9iPPDsXUUgLYmLgyJHeVKEzyEy84EKHj0Hoof3kuCCjW1wri8 AFf6yLYhl8JhfPt/xmjQN0XUOnt2HDhs0Fh8hwkBBUfxjepBFOFV6qTLbq963gbbr4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388284; 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=f7ctJzxv1DliqMHCVtOVb8QKuiaWyriS/NCZhvtkVZg=; b=N2nemmKwOP4SrYP1EUCz3InMcj9nX0S1kzV9nyz5fPjjOevkp971ZrPcH8bRVJsKxdTT J61fcnFz7qCKOF7TP4YpkjDR1GSS+FbZZ2D3X6/RbHeKuqAISp903Um3yQFxNRWsP8eHT 9jnCb0TodF129zGzFCObmXkvaYK994Z+q6mXAvPpvTZqDmTkcTxApq7Ficj8rOXUNJ+zj YXRkvRyFQvw2N+wjz+EIwYEf6SpAvoW3ZA7KMdA/c4icD/cYZXCwcoP/8NrX8Gjt1FInS pBZ6oyfdXiILmlqlvVBwndpheWZ+JqXitSkaxECU0LOaqBtrj+h/OWI0AL7HS0vOFFg== 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=nTH8Oknw; 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 362C6606A330; Fri, 4 Dec 2026 12:44:44 +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=nTH8Oknw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE301F000C2; Fri, 4 Dec 2026 12:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388283; bh=f7ctJzxv1DliqMHCVtOVb8QKuiaWyriS/NCZhvtkVZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nTH8OknwAjFThHMKk9SNNT07vpx5m7SnXW7AASGUivNNSNI+iOcGPGfNXiNpIpMxl R8hXR1j8DFraP7vu+t7K7n0y3WFumchV7Rg382x37wrVqBBO48Weo45mhmy24ErK2B dMkwTM+F6PEhIn0kBzREvcDXls5KjjPiu+3Xy4/4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Giuseppe Piscitelli , Namjae Jeon , Paulo Alcantara Subject: [PATCH 6.1 0556/1059] smb: client: flush deferred handles of other names before a hard link open Date: Fri, 4 Dec 2026 19:01:27 +0900 Message-ID: <20261204100658.587184317@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paulo Alcantara commit 25912ed3b75dcf5ff623dcb549b925dd0d0948f7 upstream. Opening a hard link of a file whose other name still holds a deferred, leased handle fails with EINVAL over SMB3. The client caches lease keys per inode, but the server ties a lease to the file name it was granted under, so reusing the inode's lease key to open a different name of the same inode is rejected with STATUS_INVALID_PARAMETER (MS-SMB2 3.3.5.9.11). Commit 262b73ef442e ("smb3 client: fix open hardlink on deferred close file error") already closes the inode's deferred handles before such an open so the new name can take a fresh lease, but cifs_get_hardlink_path() only triggered that flush when a cached handle had the same open flags as the new open, so a differently accessed name - written then read, say - slipped through and still failed. Match on the name instead: flush when a cached handle for another name of the inode is open, regardless of access mode. Reported-by: Giuseppe Piscitelli Closes: https://lore.kernel.org/r/CACmoRBbDZR3eyEM65j73sWMS7A=T89z1QAvCP=+u0WGzZhwW6g@mail.gmail.com Fixes: 262b73ef442e ("smb3 client: fix open hardlink on deferred close file error") Cc: stable@vger.kernel.org Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -1757,7 +1757,7 @@ cifs_get_hardlink_path(struct cifs_tcon spin_lock(&cinode->open_file_lock); list_for_each_entry(open_file, &cinode->openFileList, flist) { - if (file->f_flags == open_file->f_flags) { + if (open_file->dentry != file_dentry(file)) { rc = -EINVAL; break; }