summaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-09-02 16:10:59 +0100
committerSteve French <stfrench@microsoft.com>2019-09-16 11:43:37 -0500
commitac6ad7a8c9f6f1fd43262b2273a45ec1fdd3a981 (patch)
treeea53f7e554c5307b008659ce2be64019510e79fe /fs/cifs/transport.c
parentafe6f65353b644f55875d42d812ffe87f1887d68 (diff)
downloadlinux-ac6ad7a8c9f6f1fd43262b2273a45ec1fdd3a981.tar.bz2
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/transport.c')
-rw-r--r--fs/cifs/transport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 0d60bd2f4dca..a90bd4d75b4d 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -1242,12 +1242,13 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
struct kvec iov = { .iov_base = in_buf, .iov_len = len };
struct smb_rqst rqst = { .rq_iov = &iov, .rq_nvec = 1 };
struct cifs_credits credits = { .value = 1, .instance = 0 };
- struct TCP_Server_Info *server = ses->server;
+ struct TCP_Server_Info *server;
if (ses == NULL) {
cifs_dbg(VFS, "Null smb session\n");
return -EIO;
}
+ server = ses->server;
if (server == NULL) {
cifs_dbg(VFS, "Null tcp session\n");
return -EIO;