Skip to content

Commit 84d2d16

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: fix use-after-free in smb2_lock
If smb_lock->zero_len has value, ->llist of smb_lock is not delete and flock is old one. It will cause use-after-free on error handling routine. Cc: [email protected] Reported-by: Norbert Szetei <[email protected]> Tested-by: Norbert Szetei <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent e2ff19f commit 84d2d16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7458,13 +7458,13 @@ int smb2_lock(struct ksmbd_work *work)
74587458
}
74597459

74607460
no_check_cl:
7461+
flock = smb_lock->fl;
7462+
list_del(&smb_lock->llist);
7463+
74617464
if (smb_lock->zero_len) {
74627465
err = 0;
74637466
goto skip;
74647467
}
7465-
7466-
flock = smb_lock->fl;
7467-
list_del(&smb_lock->llist);
74687468
retry:
74697469
rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL);
74707470
skip:

0 commit comments

Comments
 (0)