summaryrefslogtreecommitdiff
path: root/net/nfc/digital_dep.c
diff options
context:
space:
mode:
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>2021-04-27 09:22:58 -0700
committerDavid S. Miller <davem@davemloft.net>2021-04-27 15:36:10 -0700
commit75258586793efc521e5dd52a5bf6c7a4cf7002be (patch)
tree7096aad353da99399c4f9d554dc6aa5114c5ac1d /net/nfc/digital_dep.c
parent0711459095bc9ddb5a0086146d2751e6d5412cbf (diff)
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: 1c7a4c24fbfd9 ("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>
Diffstat (limited to 'net/nfc/digital_dep.c')
-rw-r--r--net/nfc/digital_dep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
index 1150731126e2..3982fa084737 100644
--- a/net/nfc/digital_dep.c
+++ b/net/nfc/digital_dep.c
@@ -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);