Skip to content

Commit a060909

Browse files
namjaejeongregkh
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: stable@vger.kernel.org Reported-by: Norbert Szetei <norbert@doyensec.com> Tested-by: Norbert Szetei <norbert@doyensec.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 159d059 commit a060909

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

74437443
no_check_cl:
7444+
flock = smb_lock->fl;
7445+
list_del(&smb_lock->llist);
7446+
74447447
if (smb_lock->zero_len) {
74457448
err = 0;
74467449
goto skip;
74477450
}
7448-
7449-
flock = smb_lock->fl;
7450-
list_del(&smb_lock->llist);
74517451
retry:
74527452
rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL);
74537453
skip:

0 commit comments

Comments
 (0)