]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:44 +0000 (17:46 -0600)
commit779b912c94d5fa1c935e5eb0bf4198fc3a87e959
treee85bcc21a2d3e08a87dc7d269f74a30bdf36fe79
parentb22a0a85721ad7cdff7eb47988b84bc6d1673f26
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req

BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit 75258586793efc521e5dd52a5bf6c7a4cf7002be ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
net/nfc/digital_dep.c