mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib()
[ Upstream commite730cd57ac
] Some variables are leaked in the error handling in alloc_rtllib(), free the variables in the error path. Fixes:94a799425e
("From: wlanfae <wlanfae@realtek.com>") Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9f49cf5196
commit
80f81e4bcc
1 changed files with 12 additions and 4 deletions
|
@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
|
|||
err = rtllib_networks_allocate(ieee);
|
||||
if (err) {
|
||||
pr_err("Unable to allocate beacon storage: %d\n", err);
|
||||
goto failed;
|
||||
goto free_netdev;
|
||||
}
|
||||
rtllib_networks_initialize(ieee);
|
||||
|
||||
|
@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv)
|
|||
ieee->hwsec_active = 0;
|
||||
|
||||
memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32);
|
||||
rtllib_softmac_init(ieee);
|
||||
err = rtllib_softmac_init(ieee);
|
||||
if (err)
|
||||
goto free_crypt_info;
|
||||
|
||||
ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL);
|
||||
if (!ieee->pHTInfo)
|
||||
return NULL;
|
||||
goto free_softmac;
|
||||
|
||||
HTUpdateDefaultSetting(ieee);
|
||||
HTInitializeHTInfo(ieee);
|
||||
|
@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv)
|
|||
|
||||
return dev;
|
||||
|
||||
failed:
|
||||
free_softmac:
|
||||
rtllib_softmac_free(ieee);
|
||||
free_crypt_info:
|
||||
lib80211_crypt_info_free(&ieee->crypt_info);
|
||||
rtllib_networks_free(ieee);
|
||||
free_netdev:
|
||||
free_netdev(dev);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_rtllib);
|
||||
|
|
Loading…
Reference in a new issue