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=1796388286; b=PjktglU6aiB0oeIpzqgdyMhrF4CFVKmRk9B9J1x/pNx/EJOq/+y7vEPwF6/OhjBheXgq imanzIbPi4mhY0rE45cVSuFton77DLS0vr9qDdwcwR068/N9OIRvwPvABqFFRQOhlDAiz z8NemkwyaKvuylRk62GGJRZHyf3EBvqxWwYoYm0EZywxWNtjCMjk8Q5G0MjpuGiEGsMRY 7wO2eq0U6QFbprnm+AL+gHnRGI0xkCLC+nD02T0lhwxow43AqebgzPOd16UJpls43blBH y1KDdOWGGxWi4kWXa9atbXYdxKIHQk9ErIvffIwso7Frd+hMPsQjSiZIadOwKpraIxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388286; 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=NxdpUssWuECysUfZ2gdiHkE+UP8gMFke6HId4w60v9g=; b=REXenhfF4Ppzvyt6MuhjJw27XPj65hFaFb/u6CntmYTUun3rn3uYEZNNRjiGUWSypXr8 nShp+RynwE74MQ9AM757trHSZHUz4f26tA8VRQkAKToLs573jUvKR/QBGitfaomvryVj/ rBSDHvAqMKjoeAsVSx1cY50fRi5Uo3Tg4U5WeujuhU5Rqmy1MsOtLuQd996w7PkrHWHJ7 fsmQrMH9pZhymr6Aa0gKlLsQaaNQLu/YqjRxoJsWXTmOfX/53b/KiXN01H/wLw6crhC++ oQa1QQ3trY4vn8SWcJaT5UW+S0+Kd66yFuHfVNRjsdyv8aqE1clJ+G1aO3iDOjfue6Q== 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=C2IwWrpS; 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 9FEF4606A32F; Fri, 4 Dec 2026 12:44:46 +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=C2IwWrpS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1860F1F00934; Fri, 4 Dec 2026 12:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388286; bh=NxdpUssWuECysUfZ2gdiHkE+UP8gMFke6HId4w60v9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C2IwWrpSsBRK5EtiCDO+V6QFCYc4oek67hhCGVzyLf0lj7aAnYLKuUR3n2l0ubcLT ih7qFuONniDH0mvXdFy+gPGvynSyUKtGKRG+zRd2/JlmGRQaFUFMFBK6UBY+ePyqM4 KpWA8yAY6QiqlgSnnYgOG7TjXDnjarRWlLwrwrIM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joseph Qi , Paulo Alcantara Subject: [PATCH 6.1 0557/1059] smb: client: hold the inode across cifs_oplock_break() Date: Fri, 4 Dec 2026 19:01:28 +0900 Message-ID: <20261204100658.609570587@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: Joseph Qi commit fce78321f1b59531cf6fc94860550db1db8dec55 upstream. cifs_oplock_break() drops the handle reference in the middle of the handler and keeps using cinode afterwards, to send the break acknowledgment and again in cifs_done_oplock_break(). The reference cifs_queue_oplock_break() takes is the only pin: the handle holds the dentry and the dentry is what keeps the inode alive. When that put is the last reference, the dput() in cifsFileInfo_put_final() kills an unhashed dentry, drops the last i_count and evicts the inode, so the rest of the handler runs on an object whose free is only RCU-deferred. An unhashed dentry that a handle still references is an ordinary state: unlinking an open file leaves the dentry that way, and so does the dcache teardown at unmount. Take a reference on the inode for the lifetime of the handler and drop it once the break has been reported. This also covers the cifs_get_tlink() failure path, where the put is followed directly by the out label. Fixes: b98749cac4a6 ("CIFS: keep FileInfo handle live during oplock break") Fixes: 23b26f4408ac ("smb: client: avoid leaking refcount when cifs_sb_tlink() fails") Cc: stable@vger.kernel.org Signed-off-by: Joseph Qi Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -5254,6 +5254,14 @@ void cifs_oplock_break(struct work_struc __u64 persistent_fid, volatile_fid; __u16 net_fid; + /* + * Dropping the handle reference below also drops the dentry + * reference that pins this inode, and cinode is still needed to + * acknowledge the break and to report it as complete. Hold the inode + * until that is done. + */ + ihold(inode); + wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, TASK_UNINTERRUPTIBLE); @@ -5329,6 +5337,7 @@ oplock_break_ack: cifs_put_tlink(tlink); out: cifs_done_oplock_break(cinode); + iput(inode); } /*