NFC: nfcmrvl: double free on error path
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 8 Mar 2017 05:22:37 +0000 (08:22 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Sat, 1 Apr 2017 22:09:17 +0000 (00:09 +0200)
The nci_spi_send() function calls kfree_skb(skb) on both error and
success so this extra kfree_skb() is a double free.

Fixes: caf6e49bf6d0 ("NFC: nfcmrvl: add spi driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/nfcmrvl/spi.c

index e2881b15ce6cd4da54c003e79268defe50a7deed..8e0ddb43477042dfa035c1ebb05b175b39d13796 100644 (file)
@@ -95,10 +95,9 @@ static int nfcmrvl_spi_nci_send(struct nfcmrvl_private *priv,
        /* Send the SPI packet */
        err = nci_spi_send(drv_data->nci_spi, &drv_data->handshake_completion,
                           skb);
-       if (err != 0) {
+       if (err)
                nfc_err(priv->dev, "spi_send failed %d", err);
-               kfree_skb(skb);
-       }
+
        return err;
 }