mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp).
If nfc_tm_data_received() failed, the callee will free the resp via
kfree_skb() and return error. But in the exit branch, the resp
will be freed again.
My patch sets resp to NULL if nfc_tm_data_received() failed, to
avoid the double free.
Fixes: 1c7a4c24fb
("NFC Digital: Add target NFC-DEP support")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0711459095
commit
7525858679
@ -1273,6 +1273,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
|
||||
}
|
||||
|
||||
rc = nfc_tm_data_received(ddev->nfc_dev, resp);
|
||||
if (rc)
|
||||
resp = NULL;
|
||||
|
||||
exit:
|
||||
kfree_skb(ddev->chaining_skb);
|
||||
|
Loading…
Reference in New Issue
Block a user