cifs: check rsp for NULL before dereferencing in SMB2_open
Subsystems (2)
PATCH 1/1 cifs: check rsp for NULL before dereferencing in SMB2_open
In SMB2_open there are several paths where the SendReceive2 call will return an error before it sets rsp_iov.iov_base thus leaving iov_base uninitialized.
Thus we need to check rsp before we dereference it in the call to get_rfc1002_length().
A report of this issue was previously reported in
http://www.spinics.net/lists/linux-cifs/msg12846.html
RH-bugzilla : 1476151
Signed-off-by Ronnie Sahlberg <[email protected]>
--- fs/cifs/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2pdu.c +1 -1
@@ -1746,7 +1746,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,if (rc !=0 ) {cifs_stats_fail_inc (tcon,SMB2_CREATE_HE ); -if (err_buf) +if (err_buf && rsp) *err_buf =kmemdup (rsp,get_rfc1002_length (rsp) +4 ,GFP_KERNEL ); goto creat_exit;
Signature · 1 line
2.13.3