NFC: digital: fix possible memory leak in digital_in_send_sdd_req()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Wed, 13 Oct 2021 07:50:32 +0000 (15:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Oct 2021 07:33:59 +0000 (09:33 +0200)
commit88c890b0b9a1fb9fcd01c61ada515e8b636c34f9
treeaee2372fff08b4081525ce667a651a686cd3e303
parenta67d47e32c91e2b10402cb8c081774cbf08edb2e
NFC: digital: fix possible memory leak in digital_in_send_sdd_req()

commit 291c932fc3692e4d211a445ba8aa35663831bac7 upstream.

'skb' is allocated in digital_in_send_sdd_req(), but not free when
digital_in_send_cmd() failed, which will cause memory leak. Fix it
by freeing 'skb' if digital_in_send_cmd() return failed.

Fixes: 2c66daecc409 ("NFC Digital: Add NFC-A technology support")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/digital_technology.c