Bluetooth: hci_intel: Show error in case of invalid LPM packet size
authorLoic Poulain <loic.poulain@intel.com>
Wed, 2 Sep 2015 10:04:14 +0000 (12:04 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 17 Sep 2015 11:20:02 +0000 (13:20 +0200)
Don't hide this packet size error.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_intel.c

index 9fd1143bc78f80abf7723b6970fbf338f7f3eb15..b4dc3c5b384128fb6d79f5d3b664bde95a0c162a 100644 (file)
@@ -1010,8 +1010,11 @@ static int intel_recv_lpm(struct hci_dev *hdev, struct sk_buff *skb)
 
        switch (lpm->opcode) {
        case LPM_OP_TX_NOTIFY:
-               if (lpm->dlen)
-                       intel_recv_lpm_notify(hdev, lpm->data[0]);
+               if (lpm->dlen < 1) {
+                       bt_dev_err(hu->hdev, "Invalid LPM notification packet");
+                       break;
+               }
+               intel_recv_lpm_notify(hdev, lpm->data[0]);
                break;
        case LPM_OP_SUSPEND_ACK:
                set_bit(STATE_SUSPENDED, &intel->flags);