wifi: ipw2200: fix memory leak in ipw_wdev_init()

[ Upstream commit 9fe21dc626 ]

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: a3caa99e6c ("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>
This commit is contained in:
Zhengchao Shao 2022-12-09 09:24:22 +08:00 committed by Greg Kroah-Hartman
parent 345692e96b
commit 9424ea9d55
1 changed files with 7 additions and 2 deletions

View File

@ -11400,9 +11400,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;
}