Skip to content

Commit

Permalink
NFC: nfcmrvl: double free on error path
Browse files Browse the repository at this point in the history
The nci_spi_send() function calls kfree_skb(skb) on both error and
success so this extra kfree_skb() is a double free.

Fixes: caf6e49 ("NFC: nfcmrvl: add spi driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Dan Carpenter authored and Samuel Ortiz committed Apr 1, 2017
1 parent 52fdede commit ca42fb9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/nfc/nfcmrvl/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ca42fb9

Please sign in to comment.