diff options
author | Steve French <stfrench@microsoft.com> | 2021-11-11 14:39:23 -0600 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-11-11 14:49:24 -0600 |
commit | 4d9beec22f731655f1a41f91cd747a29892533e5 (patch) | |
tree | 9f7649975c6d916f378fdddf356c94ce5b8cfd81 /fs | |
parent | 0e62904836ecddf69b0358fe8f9442d3dd914c55 (diff) | |
download | linux-stable-4d9beec22f731655f1a41f91cd747a29892533e5.tar.gz linux-stable-4d9beec22f731655f1a41f91cd747a29892533e5.tar.bz2 linux-stable-4d9beec22f731655f1a41f91cd747a29892533e5.zip |
smb3: add additional null check in SMB2_ioctl
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: 1443909 ("Explicit Null dereference")
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/smb2pdu.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b20398a8097d..4dda26059aac 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3162,6 +3162,16 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, if ((plen == NULL) || (out_data == NULL)) goto ioctl_exit; + /* + * Although unlikely to be possible for rsp to be null and rc not set, + * adding check below is slightly safer long term (and quiets Coverity + * warning) + */ + if (rsp == NULL) { + rc = -EIO; + goto ioctl_exit; + } + *plen = le32_to_cpu(rsp->OutputCount); /* We check for obvious errors in the output buffer length and offset */ |