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=1796385552; b=abgMIwCm1YmaLe9viBjAQ+X4ulqrRsfWL94zfVc/mLzrWiaNHTz6irthZUDujsC4LLGa ytZfE7/5hbmcE7qZYg+NLMF08zrv4soGWE6nn574lLgSwyGqv2qRcMfk4ymmpnxv8Sxbc O9PyO/KSyEgaAwGx6TukMPuWNNu3X6ap0iy6rFgFUY2gGFmPeVA/qIShkIO/mqD333tox 5agBT7mQR9gJLTSG84lwJUp4eb4yHI0fUw5HYiKk9nnMWGjJ+WoNhB0Es6LNtTqXt/GE/ t6j1z/zD6GwPICkEqO+dY8/T0mBfA8mY7Sobc6ppECeF/BZHe/wG6pibvzC8qWhFDVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385552; 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=1u/B6YHkODAbp3nCr5bPDH+8e7ruzFAYTC5Wk5luYb4=; b=qCm25o+zMQBg80Xeo7sf71v2VB8HvnlyZsnmTcuXzwTNwrET+asMM5CYvwJ7bzAUD4jH /Xakj6Howik9Nr4cSSgBYw+t5/p5HsQfwl5a1ughOUtebCkyxkuMAFpb/U3p8jAzO95Sn RhtgGJ5y/PInzlV/3RZ2CzpvsdvjW9fTUvim3BYxrWafDGCXDIvvQi/w8BEEWtZq7X34r aTKzT1IzlzrvlYieYuu2zueBQp0leYskv3cKlMGBT1IKhsyPGWNX/hlFAqgooj8qvGi/Q csfwwdPydbceviUBwFUKHU5EvuijtPdT3rWX1752CT+Nu/VYE0JXnkUwGpg9O1il3+w== 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=jCmHL4ku; 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 52F80606A322; Fri, 4 Dec 2026 11:59:12 +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=jCmHL4ku Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9DB81F000CE; Fri, 4 Dec 2026 11:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385552; bh=1u/B6YHkODAbp3nCr5bPDH+8e7ruzFAYTC5Wk5luYb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jCmHL4kuiBIm1rqW/oSpti8KZ7KsrBVQ7Yz02P8vnW1rSlSoBJ7yyAXDBmhFO9QQQ uPrcGgs5EJ7QMAXm/kTXKiE9vdczQxDFS+Vrxmc1lkNW8cM3qmZKlL8j8BrmEf09QY 9JSjM7Kw+GiZHYntteloji7+e5FFaEd+dErERqIY= 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.6 0598/1167] smb: client: flush deferred handles of other names before a hard link open Date: Fri, 4 Dec 2026 19:00:25 +0900 Message-ID: <20261204100717.631837231@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: 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 @@ -1975,7 +1975,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; }