linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFC: nfcmrvl: double free on error path
@ 2017-03-08  5:22 Dan Carpenter
  2017-04-01 22:11 ` Samuel Ortiz
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-03-08  5:22 UTC (permalink / raw)
  To: Lauro Ramos Venancio, Vincent Cuissard
  Cc: Aloisio Almeida Jr, Samuel Ortiz, linux-wireless, kernel-janitors

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>
---
Static analysis.  Not tested.

diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c
index a7faa0bcc01e..fc8e78a29d77 100644
--- a/drivers/nfc/nfcmrvl/spi.c
+++ b/drivers/nfc/nfcmrvl/spi.c
@@ -96,10 +96,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;
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-19 13:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08  5:22 [PATCH] NFC: nfcmrvl: double free on error path Dan Carpenter
2017-04-01 22:11 ` Samuel Ortiz
2017-04-19 11:47   ` Dan Carpenter
2017-04-19 12:52     ` Samuel Ortiz
2017-04-19 13:29       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).