Skip to content

Commit eac3361

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: fix use-after-free in smb_lazy_parent_lease_break_close()
opinfo pointer obtained via rcu_dereference(fp->f_opinfo) is being accessed after rcu_read_unlock() has been called. This creates a race condition where the memory could be freed by a concurrent writer between the unlock and the subsequent pointer dereferences (opinfo->is_lease, etc.), leading to a use-after-free. Fixes: 5fb282b ("ksmbd: fix possible null-deref in smb_lazy_parent_lease_break_close") Cc: [email protected] Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 1dfd062 commit eac3361

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

fs/smb/server/oplock.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,12 @@ void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
11351135

11361136
rcu_read_lock();
11371137
opinfo = rcu_dereference(fp->f_opinfo);
1138-
rcu_read_unlock();
11391138

1140-
if (!opinfo || !opinfo->is_lease || opinfo->o_lease->version != 2)
1139+
if (!opinfo || !opinfo->is_lease || opinfo->o_lease->version != 2) {
1140+
rcu_read_unlock();
11411141
return;
1142+
}
1143+
rcu_read_unlock();
11421144

11431145
p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);
11441146
if (!p_ci)

0 commit comments

Comments
 (0)