Skip to content

Commit 1e689a5

Browse files
Marios Makassikissmfrench
authored andcommitted
smb: server: fix use-after-free in smb2_open()
The opinfo pointer obtained via rcu_dereference(fp->f_opinfo) is dereferenced after rcu_read_unlock(), creating a use-after-free window. Cc: [email protected] Signed-off-by: Marios Makassikis <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent eac3361 commit 1e689a5

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

fs/smb/server/smb2pdu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3617,10 +3617,8 @@ int smb2_open(struct ksmbd_work *work)
36173617

36183618
reconnected_fp:
36193619
rsp->StructureSize = cpu_to_le16(89);
3620-
rcu_read_lock();
3621-
opinfo = rcu_dereference(fp->f_opinfo);
3620+
opinfo = opinfo_get(fp);
36223621
rsp->OplockLevel = opinfo != NULL ? opinfo->level : 0;
3623-
rcu_read_unlock();
36243622
rsp->Flags = 0;
36253623
rsp->CreateAction = cpu_to_le32(file_info);
36263624
rsp->CreationTime = cpu_to_le64(fp->create_time);
@@ -3661,6 +3659,7 @@ int smb2_open(struct ksmbd_work *work)
36613659
next_ptr = &lease_ccontext->Next;
36623660
next_off = conn->vals->create_lease_size;
36633661
}
3662+
opinfo_put(opinfo);
36643663

36653664
if (maximal_access_ctxt) {
36663665
struct create_context *mxac_ccontext;

0 commit comments

Comments
 (0)