diff options
| author | Martin Faltesek <mfaltesek@google.com> | 2022-11-21 18:42:45 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-08 11:22:59 +0100 |
| commit | 1633e6d6aa82235f3156696c9dda49eae804acd9 (patch) | |
| tree | df5cc087da2626d6975485606a25ac8f63c6ad3c /drivers/nfc | |
| parent | 0e2a4560db77d31b005478d86b0419417742f2c1 (diff) | |
| download | linux-1633e6d6aa82235f3156696c9dda49eae804acd9.tar.gz linux-1633e6d6aa82235f3156696c9dda49eae804acd9.tar.bz2 linux-1633e6d6aa82235f3156696c9dda49eae804acd9.zip | |
nfc: st-nci: fix memory leaks in EVT_TRANSACTION
[ Upstream commit 440f2ae9c9f06e26f5dcea697a53717fc61a318c ]
Error path does not free previously allocated memory. Add devm_kfree() to
the failure path.
Reported-by: Denis Efremov <denis.e.efremov@oracle.com>
Reviewed-by: Guenter Roeck <groeck@google.com>
Fixes: 5d1ceb7f5e56 ("NFC: st21nfcb: Add HCI transaction event support")
Signed-off-by: Martin Faltesek <mfaltesek@google.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/nfc')
| -rw-r--r-- | drivers/nfc/st-nci/se.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c index 75f9a754b7eb..0cd70cd680dc 100644 --- a/drivers/nfc/st-nci/se.c +++ b/drivers/nfc/st-nci/se.c @@ -341,8 +341,10 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, /* Check next byte is PARAMETERS tag (82) */ if (skb->data[transaction->aid_len + 2] != - NFC_EVT_TRANSACTION_PARAMS_TAG) + NFC_EVT_TRANSACTION_PARAMS_TAG) { + devm_kfree(dev, transaction); return -EPROTO; + } transaction->params_len = skb->data[transaction->aid_len + 3]; memcpy(transaction->params, skb->data + |
