* FAILED: patch "[PATCH] smb: client: hold the inode across cifs_oplock_break()" failed to apply to 5.15-stable tree
@ 2026-11-25 11:11 gregkh
2026-11-26 4:03 ` [PATCH 5.15.y] smb: client: hold the inode across cifs_oplock_break() Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-11-25 11:11 UTC (permalink / raw)
To: joseph.qi, pc; +Cc: stable
The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x fce78321f1b59531cf6fc94860550db1db8dec55
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112558-throbbing-bash-4fb0@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From fce78321f1b59531cf6fc94860550db1db8dec55 Mon Sep 17 00:00:00 2001
From: Joseph Qi <joseph.qi@linux.alibaba.com>
Date: Tue, 10 Nov 2026 17:48:29 +0800
Subject: [PATCH] smb: client: hold the inode across cifs_oplock_break()
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 <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index ea793d34ab69..1247d73740a0 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3927,6 +3927,14 @@ void cifs_oplock_break(struct work_struct *work)
__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);
@@ -4014,6 +4022,7 @@ void cifs_oplock_break(struct work_struct *work)
cifs_put_tlink(tlink);
out:
cifs_done_oplock_break(cinode);
+ iput(inode);
}
#ifdef CONFIG_SWAP
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 5.15.y] smb: client: hold the inode across cifs_oplock_break()
2026-11-25 11:11 FAILED: patch "[PATCH] smb: client: hold the inode across cifs_oplock_break()" failed to apply to 5.15-stable tree gregkh
@ 2026-11-26 4:03 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-26 4:03 UTC (permalink / raw)
To: stable; +Cc: Joseph Qi, Paulo Alcantara, Sasha Levin
From: Joseph Qi <joseph.qi@linux.alibaba.com>
[ Upstream commit fce78321f1b59531cf6fc94860550db1db8dec55 ]
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 <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
[ sashal: Moved the change from fs/smb/client/file.c to fs/cifs/file.c and placed ihold() before the existing cifs_sb_active() call and iput() before cifs_sb_deactive(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/cifs/file.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index affb1ade0c15f..85bbda2d56e82 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4883,6 +4883,14 @@ void cifs_oplock_break(struct work_struct *work)
__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);
+
/*
* Hold a reference to the superblock to prevent it and its inodes from
* being freed while we are accessing cinode. Otherwise, _cifsFileInfo_put()
@@ -4964,6 +4972,7 @@ void cifs_oplock_break(struct work_struct *work)
cifs_put_tlink(tlink);
out:
cifs_done_oplock_break(cinode);
+ iput(inode);
cifs_sb_deactive(sb);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 4:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 11:11 FAILED: patch "[PATCH] smb: client: hold the inode across cifs_oplock_break()" failed to apply to 5.15-stable tree gregkh
2026-11-26 4:03 ` [PATCH 5.15.y] smb: client: hold the inode across cifs_oplock_break() Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox