Commit 74a5b966 authored by Eric Lapuyade's avatar Eric Lapuyade Committed by Samuel Ortiz

NFC: Dot not dispatch HCI event received on unopened pipe

A chip with pre-opened gates may send events on a gate that nobody
has opened in the handset host. Discard those events.
Signed-off-by: default avatarEric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 23f7e6d0
...@@ -286,6 +286,12 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, ...@@ -286,6 +286,12 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
struct sk_buff *skb) struct sk_buff *skb)
{ {
int r = 0; int r = 0;
u8 gate = nfc_hci_pipe2gate(hdev, pipe);
if (gate == 0xff) {
pr_err("Discarded event %x to unopened pipe %x\n", event, pipe);
goto exit;
}
switch (event) { switch (event) {
case NFC_HCI_EVT_TARGET_DISCOVERED: case NFC_HCI_EVT_TARGET_DISCOVERED:
...@@ -309,14 +315,11 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, ...@@ -309,14 +315,11 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
goto exit; goto exit;
} }
r = nfc_hci_target_discovered(hdev, r = nfc_hci_target_discovered(hdev, gate);
nfc_hci_pipe2gate(hdev, pipe));
break; break;
default: default:
if (hdev->ops->event_received) { if (hdev->ops->event_received) {
hdev->ops->event_received(hdev, hdev->ops->event_received(hdev, gate, event, skb);
nfc_hci_pipe2gate(hdev, pipe),
event, skb);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment