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=1795620280; b=UXsa1gHpo7oMWQ0NfxTc2LV1fSwP7fnXQOuPY7mq8Cg3NP23cSZ2ujbub3u9eVCf6Clo BgCXes61JWwM43QbFDXGSaFjTc9KgJ1SatsiQWaEo8J0G2lFo/ul9t2DpuLh6GPi3LzGi oRAxKz0eoZwMHBDg9/Vy1tirm4UQVlYGFvHfyS8W6Ixg6aEJ7WuVKF+sA66zI8vPHzlyU zAfXYojkvSiqgVVikMFemk5mVhrgqoqMbIsKKqRMScYxoie911qHidatN22X+rrhFvQwR ujpy/ZdTvocSDIL+Dt8h5yRQpr3FY2xoS1NnlKOMukxQDne52ixLupVrsctxB3AjNWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620280; 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=qniwJuaiKqu8zVSC9f3IFaARrmvT/lO8ngiubz2Mvfs=; b=IkrOArghzYST2uF/tVLYPRyAHiD3eJPheB0Kr3Lb82SXqf7CUVIPAY+G1YsHmjyHiuXq AmFrc6lBBP4vVNVWRfWTuh94LR/tkqRSAIm7WKrAgvu3JES405yGvG0Dp62DtUTxNLJu8 pMWpi9RQlsEEyjLZUdPdQG7lPTWEiKK9cLjUDL7VGCThSJGrFxP0GQvKUe0zKhFU+mcgd UBX+5MPegz06igcv+lW3LlKeCNDIY08nzY5L8FS6LqGG48PqYsSVFMmWx+jE9l3BvlI06 dhvoK1316DX6u1hpRs7xJE0v8TGmHgvpgH378PwyIEESgI7Lma8I8Ko+vQKzqYM9oNA== 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=UIi2MJJQ; 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 21C00606A323; Wed, 25 Nov 2026 15:24:40 +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=UIi2MJJQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3DDD1F000EF; Wed, 25 Nov 2026 15:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795620279; bh=qniwJuaiKqu8zVSC9f3IFaARrmvT/lO8ngiubz2Mvfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UIi2MJJQK4Q19/fewSjrDOetswxoq/ETXBf7/wvwNDUTRurHFPdG+JlAw70CA/EoU IFm9rr/yC/18tLeD7dfn2blVAA6BYDhmkm6dyQdY0c4ihTWQn/i6A/1dk7zk08IKqN Opqfyyo+7u/i8KDmbKDPrdH42e8UL7ZBoW4Go/ZA= 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 7.3 0839/1005] smb: client: flush deferred handles of other names before a hard link open Date: Wed, 25 Nov 2026 15:36:17 +0100 Message-ID: <20261125143841.372047267@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@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 7.3-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 @@ -2232,7 +2232,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; }