Skip to content

Commit bf2afee

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
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 Version 2 : * Lets properly initialize rsp_iov before we use it. Signed-off-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>. Signed-off-by: Steve French <[email protected]> Reported-by: Xiaoli Feng <[email protected]> CC: Stable <[email protected]>
1 parent 5226971 commit bf2afee

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
@@ -1634,7 +1634,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
16341634
struct cifs_tcon *tcon = oparms->tcon;
16351635
struct cifs_ses *ses = tcon->ses;
16361636
struct kvec iov[4];
1637-
struct kvec rsp_iov;
1637+
struct kvec rsp_iov = {NULL, 0};
16381638
int resp_buftype;
16391639
int uni_path_len;
16401640
__le16 *copy_path = NULL;
@@ -1763,7 +1763,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
17631763

17641764
if (rc != 0) {
17651765
cifs_stats_fail_inc(tcon, SMB2_CREATE_HE);
1766-
if (err_buf)
1766+
if (err_buf && rsp)
17671767
*err_buf = kmemdup(rsp, get_rfc1002_length(rsp) + 4,
17681768
GFP_KERNEL);
17691769
goto creat_exit;

0 commit comments

Comments
 (0)