Commit 440f2ae9 authored by Martin Faltesek's avatar Martin Faltesek Committed by Jakub Kicinski

nfc: st-nci: fix memory leaks in EVT_TRANSACTION

Error path does not free previously allocated memory. Add devm_kfree() to
the failure path.
Reported-by: default avatarDenis Efremov <denis.e.efremov@oracle.com>
Reviewed-by: default avatarGuenter Roeck <groeck@google.com>
Fixes: 5d1ceb7f ("NFC: st21nfcb: Add HCI transaction event support")
Signed-off-by: default avatarMartin Faltesek <mfaltesek@google.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c60c1522
...@@ -339,8 +339,10 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, ...@@ -339,8 +339,10 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,
/* Check next byte is PARAMETERS tag (82) */ /* Check next byte is PARAMETERS tag (82) */
if (skb->data[transaction->aid_len + 2] != if (skb->data[transaction->aid_len + 2] !=
NFC_EVT_TRANSACTION_PARAMS_TAG) NFC_EVT_TRANSACTION_PARAMS_TAG) {
devm_kfree(dev, transaction);
return -EPROTO; return -EPROTO;
}
transaction->params_len = skb->data[transaction->aid_len + 3]; transaction->params_len = skb->data[transaction->aid_len + 3];
memcpy(transaction->params, skb->data + memcpy(transaction->params, skb->data +
......
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