瀏覽代碼

NFC: Free sk_buff if nfcwilink_send fails

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>
Ilan Elias 13 年之前
父節點
當前提交
ea9917d6f9
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/nfc/nfcwilink.c

+ 4 - 2
drivers/nfc/nfcwilink.c

@@ -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);