]> git.itanic.dy.fi Git - linux-stable/commit
nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()
authorShang XiaoJing <shangxiaojing@huawei.com>
Thu, 27 Oct 2022 14:03:31 +0000 (22:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:14:17 +0000 (18:14 +0100)
commit0acfcd2aed4f7eaf086218414c6b7a197c9873f3
treef22f23718ac202fc0fe17e77d551993f404007a7
parent9ae2c9a91ff068f4c3e392f47e8e26a1c9f85ebb
nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()

[ Upstream commit 3a146b7e3099dc7cf3114f627d9b79291e2d2203 ]

s3fwrn5_nci_send() will call s3fwrn5_i2c_write() or s3fwrn82_uart_write(),
and free the skb if write() failed. However, even if the write() run
succeeds, the skb will not be freed in write(). As the result, the skb
will memleak. s3fwrn5_nci_send() should also free the skb when write()
succeeds.

Fixes: c04c674fadeb ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
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/s3fwrn5/core.c