Skip to content

Commit 3bce718

Browse files
Yunlongsgregkh
authored andcommitted
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
[ Upstream commit 7525858 ] 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: 1c7a4c2 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e2c34ca commit 3bce718

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎net/nfc/digital_dep.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
12731273
}
12741274

12751275
rc = nfc_tm_data_received(ddev->nfc_dev, resp);
1276+
if (rc)
1277+
resp = NULL;
12761278

12771279
exit:
12781280
kfree_skb(ddev->chaining_skb);

0 commit comments

Comments
 (0)