Skip to content

Commit 2c3735a

Browse files
namjaejeonopsiff
authored andcommitted
ksmbd: fix use-after-free in smb2_lock
commit 84d2d16 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 8573571)
1 parent b133f0d commit 2c3735a

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
@@ -7442,13 +7442,13 @@ int smb2_lock(struct ksmbd_work *work)
74427442
}
74437443

74447444
no_check_cl:
7445+
flock = smb_lock->fl;
7446+
list_del(&smb_lock->llist);
7447+
74457448
if (smb_lock->zero_len) {
74467449
err = 0;
74477450
goto skip;
74487451
}
7449-
7450-
flock = smb_lock->fl;
7451-
list_del(&smb_lock->llist);
74527452
retry:
74537453
rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL);
74547454
skip:

0 commit comments

Comments
 (0)