diff options
author | Colin Ian King <colin.king@canonical.com> | 2019-09-02 18:10:59 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-09-16 19:43:37 +0300 |
commit | ac6ad7a8c9f6f1fd43262b2273a45ec1fdd3a981 (patch) | |
tree | ea53f7e554c5307b008659ce2be64019510e79fe /fs/cifs/smb2pdu.c | |
parent | afe6f65353b644f55875d42d812ffe87f1887d68 (diff) | |
download | linux-ac6ad7a8c9f6f1fd43262b2273a45ec1fdd3a981.tar.xz |
cifs: fix dereference on ses before it is null checked
The assignment of pointer server dereferences pointer ses, however,
this dereference occurs before ses is null checked and hence we
have a potential null pointer dereference. Fix this by only
dereferencing ses after it has been null checked.
Addresses-Coverity: ("Dereference before null check")
Fixes: 2808c6639104 ("cifs: add new debugging macro cifs_server_dbg")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r-- | fs/cifs/smb2pdu.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index dbc6ef50dd45..0e92983de0b7 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2759,8 +2759,10 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, else return -EIO; + if (!ses) + return -EIO; server = ses->server; - if (!ses || !(server)) + if (!server) return -EIO; if (smb3_encryption_required(tcon)) @@ -3058,13 +3060,16 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, int rc = 0; int resp_buftype = CIFS_NO_BUFFER; struct cifs_ses *ses = tcon->ses; - struct TCP_Server_Info *server = ses->server; + struct TCP_Server_Info *server; int flags = 0; bool allocated = false; cifs_dbg(FYI, "Query Info\n"); - if (!ses || !(server)) + if (!ses) + return -EIO; + server = ses->server; + if (!server) return -EIO; if (smb3_encryption_required(tcon)) |