diff options
author | Shang XiaoJing <shangxiaojing@huawei.com> | 2022-11-17 19:37:14 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-21 08:31:53 +0000 |
commit | 60dcb5ff55e5c5da259a0dcc4c24c842de1abc9d (patch) | |
tree | 44ea79920a9de643f446c47a72e3bd9883c8ac93 /drivers/nfc | |
parent | 614761e1119c994a7f19e4c9f37b1d2d7fe7306e (diff) | |
download | lwn-60dcb5ff55e5c5da259a0dcc4c24c842de1abc9d.tar.gz lwn-60dcb5ff55e5c5da259a0dcc4c24c842de1abc9d.zip |
nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send()
s3fwrn5_nci_send() won't free the skb when it failed for the check
before s3fwrn5_write(). As the result, the skb will memleak. Free the
skb when the check failed.
Fixes: c04c674fadeb ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Suggested-by: Pavel Machek <pavel@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/s3fwrn5/core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c index 0270e05b68df..aec356880adf 100644 --- a/drivers/nfc/s3fwrn5/core.c +++ b/drivers/nfc/s3fwrn5/core.c @@ -105,6 +105,7 @@ static int s3fwrn5_nci_send(struct nci_dev *ndev, struct sk_buff *skb) mutex_lock(&info->mutex); if (s3fwrn5_get_mode(info) != S3FWRN5_MODE_NCI) { + kfree_skb(skb); mutex_unlock(&info->mutex); return -EINVAL; } |