diff options
author | Eric Lapuyade <eric.lapuyade@linux.intel.com> | 2012-10-17 10:49:12 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-19 17:56:58 -0500 |
commit | 74a5b96621a50a6c41377bad65149930b050df98 (patch) | |
tree | 7f4a217fe623f16e0a90843052d902603182affa | |
parent | 23f7e6d0d060e2eb0be1daef818d030025453b44 (diff) |
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: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | net/nfc/hci/core.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index a58db89b4555..38d5f96dfd10 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -286,6 +286,12 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, | |||
286 | struct sk_buff *skb) | 286 | struct sk_buff *skb) |
287 | { | 287 | { |
288 | int r = 0; | 288 | int r = 0; |
289 | u8 gate = nfc_hci_pipe2gate(hdev, pipe); | ||
290 | |||
291 | if (gate == 0xff) { | ||
292 | pr_err("Discarded event %x to unopened pipe %x\n", event, pipe); | ||
293 | goto exit; | ||
294 | } | ||
289 | 295 | ||
290 | switch (event) { | 296 | switch (event) { |
291 | case NFC_HCI_EVT_TARGET_DISCOVERED: | 297 | 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 | goto exit; | 315 | goto exit; |
310 | } | 316 | } |
311 | 317 | ||
312 | r = nfc_hci_target_discovered(hdev, | 318 | r = nfc_hci_target_discovered(hdev, gate); |
313 | nfc_hci_pipe2gate(hdev, pipe)); | ||
314 | break; | 319 | break; |
315 | default: | 320 | default: |
316 | if (hdev->ops->event_received) { | 321 | if (hdev->ops->event_received) { |
317 | hdev->ops->event_received(hdev, | 322 | hdev->ops->event_received(hdev, gate, event, skb); |
318 | nfc_hci_pipe2gate(hdev, pipe), | ||
319 | event, skb); | ||
320 | return; | 323 | return; |
321 | } | 324 | } |
322 | 325 | ||