NFC: Free sk_buff if nfcwilink_send fails
authorIlan Elias <ilane@ti.com>
Tue, 17 Jan 2012 12:11:33 +0000 (14:11 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Jan 2012 19:21:56 +0000 (14:21 -0500)
Free sk_buff if nfcwilink_send fails.

Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/nfc/nfcwilink.c

index 90af28d611f66b71292af451577fc43d33082b69..1f74a77d040df4c5b9b93589cf786c4deea12c4d 100644 (file)
@@ -489,8 +489,10 @@ static int nfcwilink_send(struct sk_buff *skb)
 
        nfc_dev_dbg(&drv->pdev->dev, "send entry, len %d", skb->len);
 
-       if (!test_bit(NFCWILINK_RUNNING, &drv->flags))
-               return -EBUSY;
+       if (!test_bit(NFCWILINK_RUNNING, &drv->flags)) {
+               kfree_skb(skb);
+               return -EINVAL;
+       }
 
        /* add the ST hdr to the start of the buffer */
        hdr.len = cpu_to_le16(skb->len);