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=1796385555; b=JcREHJW3XToDyxuu4/HN8QggOzfnLSb4HZ8b9vHEci1iRlOtw4dVXJIOTPebvEiabueD b1TZX/MB7I+yAMMW6XpQNiuJ3Qd6IV8FZ4ZuyJMtMlM9i/LBR9whF+n9j7QdKuuplCRJF N1SJATZHZFJJdNVwnpQ3o8HK3pAfenAhvGiwTI+zQYWiQBwlyEGhfTA8/S8Uz5fECakoF YcTBt2gbrScv/B3YfEAGuDcEbalWZh8cA4MR5404fYcxQON2ZB5dPGHgokV+B8T9ltO92 Ub4jfcEOG+kW8IhrfAi0ldvrRBBFMbjApu4+WxUI4Apr9U9PrTEUn93bWbyPQPNNJ0g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385555; 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=zSf4SGD6pnqr/zUVTHFHAsT1zrwQz47a4InoPR/UKTI=; b=e0NW20Jhyyi2oSyJvRS7OUG6UM4beV5vclgksizce+pt2wG9FCEaZVD+93BLTR82oUzM k4bQxqFRLoUudp58j6v5Ri6K4ixOVIprGgHVBtXK5W/OIlsFBu+7xqEDBG8f9Ps3llylW MRYdtwjcF9RKmj8kYWT/HpxqUTm4UVBKtmLSG1plIG4VqfJs/V6c032ZdEjSaahnknSw9 YZ+09FyDhJtzJvQD7dOpyrz91//Se3r+2SF80RfNG7oZUFCmIUSpZX3yhU5XBaqPjw1sf AIoQ0uyHkx/C8f7grnV4dDgd8R8YlPyXz/tAnSFdvPEoKbcUfCA4e5Qfq48fVnvT56w== 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="n9+6/jWS"; 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 2C9A9606A32D; Fri, 4 Dec 2026 11:59:14 +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=n9+6/jWS Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF761F000CE; Fri, 4 Dec 2026 11:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385554; bh=zSf4SGD6pnqr/zUVTHFHAsT1zrwQz47a4InoPR/UKTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=n9+6/jWSLyNOwNn5KjjOCkgzp16weiqH/nbTd3OlSHdgngV3HpVa7ecOMl6Qr6OvL z8ykbXZlJVTY+dX6b5Q+29B99ga5NEDUf/DOxoEXet2NS5sqLpeV2301AZPueUNl3L W1W3aKyozGVocuw8fmQbODIo2LGL55C+Q2eaW9m8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joseph Qi , Paulo Alcantara Subject: [PATCH 6.6 0599/1167] smb: client: hold the inode across cifs_oplock_break() Date: Fri, 4 Dec 2026 19:00:26 +0900 Message-ID: <20261204100717.657823871@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: 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 @@ -5283,6 +5283,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); @@ -5358,6 +5366,7 @@ oplock_break_ack: cifs_put_tlink(tlink); out: cifs_done_oplock_break(cinode); + iput(inode); } /*