diff options
| author | Namjae Jeon <linkinjeon@kernel.org> | 2026-06-28 09:30:00 +0900 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-06-30 21:29:46 -0500 |
| commit | 5138c84dbb501363510f6f9c300797b240a119cb (patch) | |
| tree | 7b9cc8d37b43abe3bd75b88897c2a7fa409cb316 /scripts/Makefile.thinlto | |
| parent | c706195e5e06402d8d1d20908978cdc82eae6185 (diff) | |
| download | linux-5138c84dbb501363510f6f9c300797b240a119cb.tar.gz linux-5138c84dbb501363510f6f9c300797b240a119cb.zip | |
ksmbd: snapshot previous oplock state before durable checks
smb_grant_oplock() checks the previous oplock holder's o_fp to decide
whether a durable handle should be invalidated when the oplock break
cannot be delivered. prev_opinfo is obtained with opinfo_get_list(),
which pins only the oplock_info. It does not pin the ksmbd_file stored
in opinfo->o_fp.
A concurrent last close can unlink the opinfo from ci->m_op_list under
ci->m_lock and then free the ksmbd_file. The oplock_info can still be
kept alive by the refcount taken by opinfo_get_list(), but o_fp may
already point at freed memory by the time smb_grant_oplock() reads
is_durable, conn, or tcon.
Snapshot the previous holder's durable state while ci->m_lock is held,
then use only the copied values after dropping the lock. This keeps the
o_fp lifetime tied to the inode lock without taking an extra ksmbd_file
reference. Taking such a reference is unsafe here because smb_grant_oplock()
does not necessarily have the previous holder's session work, and dropping
the temporary reference can otherwise become the final putter.
Fixes: 26fa88dc877c ("ksmbd: invalidate durable handles on oplock break")
Reported-by: Gil Portnoy <dddhkts1@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
