diff options
-rw-r--r-- | drivers/nfc/st21nfca/st21nfca_se.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/nfc/st21nfca/st21nfca_se.c b/drivers/nfc/st21nfca/st21nfca_se.c index 9b93d3904ab5..bd13cac9c66a 100644 --- a/drivers/nfc/st21nfca/st21nfca_se.c +++ b/drivers/nfc/st21nfca/st21nfca_se.c | |||
@@ -301,6 +301,8 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, | |||
301 | u8 event, struct sk_buff *skb) | 301 | u8 event, struct sk_buff *skb) |
302 | { | 302 | { |
303 | int r = 0; | 303 | int r = 0; |
304 | struct device *dev = &hdev->ndev->dev; | ||
305 | struct nfc_evt_transaction *transaction; | ||
304 | 306 | ||
305 | pr_debug("connectivity gate event: %x\n", event); | 307 | pr_debug("connectivity gate event: %x\n", event); |
306 | 308 | ||
@@ -308,6 +310,25 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, | |||
308 | case ST21NFCA_EVT_CONNECTIVITY: | 310 | case ST21NFCA_EVT_CONNECTIVITY: |
309 | break; | 311 | break; |
310 | case ST21NFCA_EVT_TRANSACTION: | 312 | case ST21NFCA_EVT_TRANSACTION: |
313 | if (skb->len < NFC_MIN_AID_LENGTH + 2 && | ||
314 | skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG) | ||
315 | return -EPROTO; | ||
316 | |||
317 | transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, | ||
318 | skb->len - 2, GFP_KERNEL); | ||
319 | |||
320 | transaction->aid_len = skb->data[1]; | ||
321 | memcpy(transaction->aid, &skb->data[2], skb->data[1]); | ||
322 | |||
323 | if (skb->data[transaction->aid_len + 2] != | ||
324 | NFC_EVT_TRANSACTION_PARAMS_TAG) | ||
325 | return -EPROTO; | ||
326 | |||
327 | transaction->params_len = skb->data[transaction->aid_len + 3]; | ||
328 | memcpy(transaction->params, skb->data + | ||
329 | transaction->aid_len + 4, transaction->params_len); | ||
330 | |||
331 | r = nfc_se_transaction(hdev->ndev, host, transaction); | ||
311 | break; | 332 | break; |
312 | default: | 333 | default: |
313 | return 1; | 334 | return 1; |