diff options
| author | Gustavo A. R. Silva <garsilva@embeddedor.com> | 2018-04-03 17:00:40 -0400 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2018-04-11 17:44:58 -0400 |
| commit | c0953f2ed510c31a375193e9dbca9774e77fb4b7 (patch) | |
| tree | 410692c8d7f7cb41cc10545daf6ec41537154489 /fs/cifs/smb2pdu.c | |
| parent | 8837c70d531a1788f975c366c254a5cb973a5291 (diff) | |
cifs: smb2pdu: Fix potential NULL pointer dereference
tcon->ses is being dereferenced before it is null checked, hence
there is a potential null pointer dereference.
Fix this by moving the pointer dereference after tcon->ses has
been properly null checked.
Addresses-Coverity-ID: 1467426 ("Dereference before null check")
Fixes: 93012bf98416 ("cifs: add server->vals->header_preamble_size")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
| -rw-r--r-- | fs/cifs/smb2pdu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index f7741cee2a4c..e5ac474d5d87 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -3454,7 +3454,7 @@ static int | |||
| 3454 | build_qfs_info_req(struct kvec *iov, struct cifs_tcon *tcon, int level, | 3454 | build_qfs_info_req(struct kvec *iov, struct cifs_tcon *tcon, int level, |
| 3455 | int outbuf_len, u64 persistent_fid, u64 volatile_fid) | 3455 | int outbuf_len, u64 persistent_fid, u64 volatile_fid) |
| 3456 | { | 3456 | { |
| 3457 | struct TCP_Server_Info *server = tcon->ses->server; | 3457 | struct TCP_Server_Info *server; |
| 3458 | int rc; | 3458 | int rc; |
| 3459 | struct smb2_query_info_req *req; | 3459 | struct smb2_query_info_req *req; |
| 3460 | unsigned int total_len; | 3460 | unsigned int total_len; |
| @@ -3464,6 +3464,8 @@ build_qfs_info_req(struct kvec *iov, struct cifs_tcon *tcon, int level, | |||
| 3464 | if ((tcon->ses == NULL) || (tcon->ses->server == NULL)) | 3464 | if ((tcon->ses == NULL) || (tcon->ses->server == NULL)) |
| 3465 | return -EIO; | 3465 | return -EIO; |
| 3466 | 3466 | ||
| 3467 | server = tcon->ses->server; | ||
| 3468 | |||
| 3467 | rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, (void **) &req, | 3469 | rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, (void **) &req, |
| 3468 | &total_len); | 3470 | &total_len); |
| 3469 | if (rc) | 3471 | if (rc) |
