diff options
author | Lv Yunlong <lyl2019@mail.ustc.edu.cn> | 2021-04-27 09:22:58 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-14 09:44:32 +0200 |
commit | 24c54e0a97477ef6146f1deeae435687347a067d (patch) | |
tree | 995028bdeda07da77801c438aa41a16ec176013d /net/nfc | |
parent | 07ef3f7bc5c4f9f5250293cfee5202856bc7787c (diff) | |
download | linux-stable-24c54e0a97477ef6146f1deeae435687347a067d.tar.gz linux-stable-24c54e0a97477ef6146f1deeae435687347a067d.tar.bz2 linux-stable-24c54e0a97477ef6146f1deeae435687347a067d.zip |
net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
[ 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>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/digital_dep.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index 65aaa9d7c813..bcd4d74e8a82 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c @@ -1276,6 +1276,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); |