Skip to content

Commit ca780da

Browse files
committed
smb3: add additional null check in SMB311_posix_mkdir
Although unlikely for it to be possible for rsp to be null here, the check is safer to add, and quiets a Coverity warning. Addresses-Coverity: 1437501 ("Explicit Null dereference") Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 9e7ffa7 commit ca780da

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/cifs/smb2pdu.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,18 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
26682668
goto err_free_rsp_buf;
26692669
}
26702670

2671+
/*
2672+
* Although unlikely to be possible for rsp to be null and rc not set,
2673+
* adding check below is slightly safer long term (and quiets Coverity
2674+
* warning)
2675+
*/
26712676
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
2677+
if (rsp == NULL) {
2678+
rc = -EIO;
2679+
kfree(pc_buf);
2680+
goto err_free_req;
2681+
}
2682+
26722683
trace_smb3_posix_mkdir_done(xid, le64_to_cpu(rsp->PersistentFileId),
26732684
tcon->tid,
26742685
ses->Suid, CREATE_NOT_FILE,

0 commit comments

Comments
 (0)