Bluetooth: btqcomsmd: Fix skb double free corruption
authorLoic Poulain <loic.poulain@linaro.org>
Wed, 22 Nov 2017 14:03:17 +0000 (15:03 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 12 Dec 2017 23:28:41 +0000 (00:28 +0100)
In case of hci send frame failure, skb is still owned
by the caller (hci_core) and then should not be freed.

This fixes crash on dragonboard-410c when sending SCO
packet. skb is freed by both btqcomsmd and hci_core.

Fixes: 1511cc750c3d ("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btqcomsmd.c

index 663bed63b87159e6c069d084f9654e9e2f872c28..2c9a5fc9137da0d3d48b376c9e3b11ca0c99f265 100644 (file)
@@ -88,7 +88,8 @@ static int btqcomsmd_send(struct hci_dev *hdev, struct sk_buff *skb)
                break;
        }
 
-       kfree_skb(skb);
+       if (!ret)
+               kfree_skb(skb);
 
        return ret;
 }