]> git.baikalelectronics.ru Git - kernel.git/commit
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Tue, 27 Apr 2021 16:22:58 +0000 (09:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Apr 2021 22:36:10 +0000 (15:36 -0700)
commitaad192c3afc2692bf1424ba3ebd061a046ee757b
tree7096aad353da99399c4f9d554dc6aa5114c5ac1d
parentfda6f157dab40a9b774e25cbc3c4327805e2e488
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: 846f590d9c5f7 ("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>
net/nfc/digital_dep.c