summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/ipw2x00/ipw2200.c
diff options
context:
space:
mode:
authorZhengchao Shao <shaozhengchao@huawei.com>2022-12-09 04:24:22 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 18:26:35 +0300
commit75d20ba9506eb90d92e660e04dd887ff1495fcc3 (patch)
treeb578dae84a5dc3a97cc64d45e6ec0dbff21550eb /drivers/net/wireless/intel/ipw2x00/ipw2200.c
parent044d74c0cad679f5dde3ed60de1f7c78104197b8 (diff)
downloadlinux-75d20ba9506eb90d92e660e04dd887ff1495fcc3.tar.xz
wifi: ipw2200: fix memory leak in ipw_wdev_init()
[ Upstream commit 9fe21dc626117fb44a8eb393713a86a620128ce3 ] 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@huawei.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20221209012422.182669-1-shaozhengchao@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/wireless/intel/ipw2x00/ipw2200.c')
-rw-r--r--drivers/net/wireless/intel/ipw2x00/ipw2200.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 2d0734ab3f74..3c447d6f84af 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -11437,9 +11437,14 @@ 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))
- rc = -EIO;
+ rc = wiphy_register(wdev->wiphy);
+ if (rc)
+ goto out;
+
+ return 0;
out:
+ kfree(priv->ieee->a_band.channels);
+ kfree(priv->ieee->bg_band.channels);
return rc;
}