[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221208122630.2850534-1-shaozhengchao@huawei.com>
Date: Thu, 8 Dec 2022 20:26:30 +0800
From: Zhengchao Shao <shaozhengchao@...wei.com>
To: <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
<stas.yakovlev@...il.com>, <kvalo@...nel.org>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
CC: <linville@...driver.com>, <weiyongjun1@...wei.com>,
<yuehaibing@...wei.com>, <shaozhengchao@...wei.com>
Subject: [PATCH] ipw2200: fix memory leak in ipw_wdev_init()
In the error path of ipw_wdev_init(), exception value is returned, and
the memory applied for in the function is not released. Also the memory
is not released in ipw_pci_probe(). As a result, memory leakage occurs.
So memory release needs to be added to the error path of ipw_wdev_init().
Fixes: a3caa99e6c68 ("libipw: initiate cfg80211 API conversion (v2)")
Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
---
drivers/net/wireless/intel/ipw2x00/ipw2200.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 5b483de18c81..cead5c7fc91e 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -11397,9 +11397,15 @@ static int ipw_wdev_init(struct net_device *dev)
set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
/* With that information in place, we can now register the wiphy... */
- if (wiphy_register(wdev->wiphy))
+ if (wiphy_register(wdev->wiphy)) {
rc = -EIO;
+ goto out;
+ }
+
+ return 0;
out:
+ kfree(priv->ieee->a_band.channels);
+ kfree(priv->ieee->bg_band.channels);
return rc;
}
--
2.34.1
Powered by blists - more mailing lists