NFC: Fixed skb leak in tm_send() nfc and hci ops implementations
authorEric Lapuyade <eric.lapuyade@linux.intel.com>
Tue, 4 Dec 2012 15:44:25 +0000 (16:44 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 9 Jan 2013 23:51:50 +0000 (00:51 +0100)
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/pn544/pn544.c
net/nfc/hci/core.c

index 9349c548e8dc4e33dfa3f4a56123b44efc35065e..cd8fb16f5416dc9e238833a650cbc19625a8df36 100644 (file)
@@ -675,11 +675,17 @@ static int pn544_hci_im_transceive(struct nfc_hci_dev *hdev,
 
 static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb)
 {
+       int r;
+
        /* Set default false for multiple information chaining */
        *skb_push(skb, 1) = 0;
 
-       return nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE,
-                               PN544_HCI_EVT_SND_DATA, skb->data, skb->len);
+       r = nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE,
+                              PN544_HCI_EVT_SND_DATA, skb->data, skb->len);
+
+       kfree_skb(skb);
+
+       return r;
 }
 
 static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
index 0430f3086e4127c7a637834233627a96c0144926..d9190da4a403fa36ce5c6ef6dc86b9c9dbb6ecc8 100644 (file)
@@ -675,8 +675,10 @@ static int hci_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
 
        if (hdev->ops->tm_send)
                return hdev->ops->tm_send(hdev, skb);
-       else
-               return -ENOTSUPP;
+
+       kfree_skb(skb);
+
+       return -ENOTSUPP;
 }
 
 static int hci_check_presence(struct nfc_dev *nfc_dev,