nfc: fix potential illegal memory access
authorYang Wei <albin_yang@163.com>
Mon, 8 Jul 2019 14:57:39 +0000 (22:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:33:34 +0000 (09:33 +0200)
[ Upstream commit dd006fc434e107ef90f7de0db9907cbc1c521645 ]

The frags_q is not properly initialized, it may result in illegal memory
access when conn_info is NULL.
The "goto free_exit" should be replaced by "goto exit".

Signed-off-by: Yang Wei <albin_yang@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/nci/data.c

index dbd24254412a69d4c18c69a37d90608854a2ba9e..d203837797102456dd6e8a42eac928ff4f3cce11 100644 (file)
@@ -119,7 +119,7 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
        conn_info = nci_get_conn_info_by_conn_id(ndev, conn_id);
        if (!conn_info) {
                rc = -EPROTO;
-               goto free_exit;
+               goto exit;
        }
 
        __skb_queue_head_init(&frags_q);