Skip to content

Commit 6a3eb33

Browse files
z00467499Steve French
authored andcommitted
cifs: Fix use-after-free in SMB2_write
There is a KASAN use-after-free: BUG: KASAN: use-after-free in SMB2_write+0x1342/0x1580 Read of size 8 at addr ffff8880b6a8e450 by task ln/4196 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 618d919 commit 6a3eb33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3769,7 +3769,6 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
37693769

37703770
rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,
37713771
&resp_buftype, flags, &rsp_iov);
3772-
cifs_small_buf_release(req);
37733772
rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;
37743773

37753774
if (rc) {
@@ -3787,6 +3786,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
37873786
io_parms->offset, *nbytes);
37883787
}
37893788

3789+
cifs_small_buf_release(req);
37903790
free_rsp_buf(resp_buftype, rsp);
37913791
return rc;
37923792
}

0 commit comments

Comments
 (0)