diff options
author | Eric Lapuyade <eric.lapuyade@linux.intel.com> | 2012-10-17 16:49:12 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-19 23:56:58 +0100 |
commit | 74a5b96621a50a6c41377bad65149930b050df98 (patch) | |
tree | 7f4a217fe623f16e0a90843052d902603182affa /net/nfc | |
parent | 23f7e6d0d060e2eb0be1daef818d030025453b44 (diff) | |
download | linux-3.10-74a5b96621a50a6c41377bad65149930b050df98.tar.gz linux-3.10-74a5b96621a50a6c41377bad65149930b050df98.tar.bz2 linux-3.10-74a5b96621a50a6c41377bad65149930b050df98.zip |
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>
Diffstat (limited to 'net/nfc')
-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 a58db89b455..38d5f96dfd1 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, struct sk_buff *skb) { 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) { case NFC_HCI_EVT_TARGET_DISCOVERED: @@ -309,14 +315,11 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, goto exit; } - r = nfc_hci_target_discovered(hdev, - nfc_hci_pipe2gate(hdev, pipe)); + r = nfc_hci_target_discovered(hdev, gate); break; default: if (hdev->ops->event_received) { - hdev->ops->event_received(hdev, - nfc_hci_pipe2gate(hdev, pipe), - event, skb); + hdev->ops->event_received(hdev, gate, event, skb); return; } |