nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()
authorShang XiaoJing <shangxiaojing@huawei.com>
Thu, 27 Oct 2022 14:03:30 +0000 (22:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:15:27 +0000 (18:15 +0100)
commit3cba1f061bfe23fece2841129ca2862cdec29d5c
treeab84f31227022e80e7a9aa42bba9dd1248476650
parent44bc1868a4f542502ea2221fe5ad88ca66d1c6b6
nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()

[ Upstream commit 7bf1ed6aff0f70434bd0cdd45495e83f1dffb551 ]

nxp_nci_send() will call nxp_nci_i2c_write(), and only free skb when
nxp_nci_i2c_write() failed. However, even if the nxp_nci_i2c_write()
run succeeds, the skb will not be freed in nxp_nci_i2c_write(). As the
result, the skb will memleak. nxp_nci_send() should also free the skb
when nxp_nci_i2c_write() succeeds.

Fixes: dece45855a8b ("NFC: nxp-nci: Add support for NXP NCI chips")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nfc/nxp-nci/core.c