Commit 2740b25f authored by Shang XiaoJing's avatar Shang XiaoJing Committed by openeuler-sync-bot
Browse files

nfc: nxp-nci: Fix potential memory leak in nxp_nci_send()

stable inclusion
from stable-v5.10.154
commit 9ae2c9a91ff068f4c3e392f47e8e26a1c9f85ebb
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I64YCB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9ae2c9a91ff068f4c3e392f47e8e26a1c9f85ebb



--------------------------------

[ Upstream commit 7bf1ed6a ]

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: dece4585 ("NFC: nxp-nci: Add support for NXP NCI chips")
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLipeng Sang <sanglipeng1@jd.com>
(cherry picked from commit e4732a32)
parent a48ff3e2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment