]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
CIFS: Fix NULL pointer deref on SMB2_tcon() failure
authorAurélien Aptel <aaptel@suse.com>
Wed, 11 Oct 2017 11:23:36 +0000 (13:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Nov 2017 08:54:47 +0000 (09:54 +0100)
commit db3b5474f462e77b82ca1e27627f03c47b622c99 upstream.

If SendReceive2() fails rsp is set to NULL but is dereferenced in the
error handling code.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2pdu.c

index ddc633ef606475b40d14cbd53cbf80e00e86469a..8c17020d44a91b8e3fe663bedfca68c37db2da96 100644 (file)
@@ -1243,7 +1243,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
        struct smb2_tree_connect_req *req;
        struct smb2_tree_connect_rsp *rsp = NULL;
        struct kvec iov[2];
-       struct kvec rsp_iov;
+       struct kvec rsp_iov = { NULL, 0 };
        int rc = 0;
        int resp_buftype;
        int unc_path_len;
@@ -1360,7 +1360,7 @@ tcon_exit:
        return rc;
 
 tcon_error_exit:
-       if (rsp->hdr.sync_hdr.Status == STATUS_BAD_NETWORK_NAME) {
+       if (rsp && rsp->hdr.sync_hdr.Status == STATUS_BAD_NETWORK_NAME) {
                cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree);
        }
        goto tcon_exit;