summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/btsdio.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-01-16 00:02:21 +0300
committerMarcel Holtmann <marcel@holtmann.org>2020-01-16 00:28:51 +0300
commit7e8aeffb112aa1d1600ce0ee44e444b63e3d41f9 (patch)
treeebb943f999d25734a7dd1777b2fbe5f930d8f767 /drivers/bluetooth/btsdio.c
parent1cc3c10c5aea84d4b0400423449c316eed3f27df (diff)
downloadlinux-7e8aeffb112aa1d1600ce0ee44e444b63e3d41f9.tar.xz
Bluetooth: btsdio: Check for valid packet type
Check for valid packet type before calling hci_recv_frame which is inline with what other drivers are doing. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btsdio.c')
-rw-r--r--drivers/bluetooth/btsdio.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index fd9571d5fdac..199e8f7d426d 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -145,11 +145,20 @@ static int btsdio_rx_packet(struct btsdio_data *data)
data->hdev->stat.byte_rx += len;
- hci_skb_pkt_type(skb) = hdr[3];
-
- err = hci_recv_frame(data->hdev, skb);
- if (err < 0)
- return err;
+ switch (hdr[3]) {
+ case HCI_EVENT_PKT:
+ case HCI_ACLDATA_PKT:
+ case HCI_SCODATA_PKT:
+ case HCI_ISODATA_PKT:
+ hci_skb_pkt_type(skb) = hdr[3];
+ err = hci_recv_frame(data->hdev, skb);
+ if (err < 0)
+ return err;
+ break;
+ default:
+ kfree_skb(skb);
+ return -EINVAL;
+ }
sdio_writeb(data->func, 0x00, REG_PC_RRT, NULL);