Message ID | 20221209012422.182669-1-shaozhengchao@huawei.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2] ipw2200: fix memory leak in ipw_wdev_init() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Zhengchao Shao <shaozhengchao@huawei.com> wrote: > 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> Patch applied to wireless-next.git, thanks. 9fe21dc62611 wifi: ipw2200: fix memory leak in ipw_wdev_init()
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index 5b483de18c81..4c317a7c93ac 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -11397,9 +11397,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; }
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> --- v2: return value of wiphy_register() instead of -EIO --- drivers/net/wireless/intel/ipw2x00/ipw2200.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)