Skip to content

Commit 088aaf1

Browse files
z00467499Steve French
authored andcommitted
cifs: Fix use-after-free in SMB2_read
There is a KASAN use-after-free: BUG: KASAN: use-after-free in SMB2_read+0x1136/0x1190 Read of size 8 at addr ffff8880b4e45e50 by task ln/1009 Should not release the 'req' because it will use in the trace. Fixes: eccb442 ("smb3: Add ftrace tracepoints for improved SMB3 debugging") Signed-off-by: ZhangXiaoxu <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> 4.18+ Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent 6a3eb33 commit 088aaf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cifs/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,8 +3448,6 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
34483448
rqst.rq_nvec = 1;
34493449

34503450
rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
3451-
cifs_small_buf_release(req);
3452-
34533451
rsp = (struct smb2_read_rsp *)rsp_iov.iov_base;
34543452

34553453
if (rc) {
@@ -3471,6 +3469,8 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
34713469
io_parms->tcon->tid, ses->Suid,
34723470
io_parms->offset, io_parms->length);
34733471

3472+
cifs_small_buf_release(req);
3473+
34743474
*nbytes = le32_to_cpu(rsp->DataLength);
34753475
if ((*nbytes > CIFS_MAX_MSGSIZE) ||
34763476
(*nbytes > io_parms->length)) {

0 commit comments

Comments
 (0)