From: Colin King <colin.king@canonical.com> To: Steve French <sfrench@samba.org>, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][cifs-next] cifs: fix dereference on ses before it is null checked Date: Mon, 2 Sep 2019 16:01:52 +0100 [thread overview] Message-ID: <20190902150152.21550-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> 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> --- fs/cifs/transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Colin King <colin.king@canonical.com> To: Steve French <sfrench@samba.org>, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][cifs-next] cifs: fix dereference on ses before it is null checked Date: Mon, 02 Sep 2019 15:01:52 +0000 [thread overview] Message-ID: <20190902150152.21550-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> 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> --- fs/cifs/transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.20.1
next reply other threads:[~2019-09-02 15:02 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-02 15:01 Colin King [this message] 2019-09-02 15:01 ` [PATCH][cifs-next] cifs: fix dereference on ses before it is null checked Colin King
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190902150152.21550-1-colin.king@canonical.com \ --to=colin.king@canonical.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-cifs@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=samba-technical@lists.samba.org \ --cc=sfrench@samba.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.