[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117113714.12776-4-shangxiaojing@huawei.com>
Date: Thu, 17 Nov 2022 19:37:14 +0800
From: Shang XiaoJing <shangxiaojing@...wei.com>
To: <krzysztof.kozlowski@...aro.org>, <pavel@...x.de>,
<u.kleine-koenig@...gutronix.de>, <kuba@...nel.org>,
<michael@...le.cc>, <cuissard@...vell.com>,
<sameo@...ux.intel.com>, <clement.perrochaud@....com>,
<r.baldyga@...sung.com>, <netdev@...r.kernel.org>
CC: <shangxiaojing@...wei.com>
Subject: [PATCH 3/3] 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@...wei.com>
Suggested-by: Pavel Machek <pavel@...x.de>
---
drivers/nfc/s3fwrn5/core.c | 1 +
1 file changed, 1 insertion(+)
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;
}
--
2.17.1
Powered by blists - more mailing lists