From: Dan Carpenter Date: Wed, 8 Mar 2017 05:22:37 +0000 (+0300) Subject: NFC: nfcmrvl: double free on error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ca42fb9e52d155547e6cf18cf26bce3e1a6af4ea;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git NFC: nfcmrvl: double free on error path 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 Signed-off-by: Samuel Ortiz --- diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index e2881b15ce6c..8e0ddb434770 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -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; }