提交 2ab1503c 编写于 作者: Y Yang Yingliang 提交者: Zheng Zengkai

staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib()

stable inclusion
from stable-v5.10.94
commit 2a7edcb3ef72ec5fc9bb3e22e01dd9553becd7ac
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2a7edcb3ef72ec5fc9bb3e22e01dd9553becd7ac

--------------------------------

[ Upstream commit e730cd57 ]

Some variables are leaked in the error handling in alloc_rtllib(), free
the variables in the error path.

Fixes: 94a79942 ("From: wlanfae <wlanfae@realtek.com>")
Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 cc0a98ef
...@@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) ...@@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
err = rtllib_networks_allocate(ieee); err = rtllib_networks_allocate(ieee);
if (err) { if (err) {
pr_err("Unable to allocate beacon storage: %d\n", err); pr_err("Unable to allocate beacon storage: %d\n", err);
goto failed; goto free_netdev;
} }
rtllib_networks_initialize(ieee); rtllib_networks_initialize(ieee);
...@@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) ...@@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv)
ieee->hwsec_active = 0; ieee->hwsec_active = 0;
memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); 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); ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL);
if (!ieee->pHTInfo) if (!ieee->pHTInfo)
return NULL; goto free_softmac;
HTUpdateDefaultSetting(ieee); HTUpdateDefaultSetting(ieee);
HTInitializeHTInfo(ieee); HTInitializeHTInfo(ieee);
...@@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) ...@@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv)
return dev; 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); free_netdev(dev);
return NULL; return NULL;
} }
EXPORT_SYMBOL(alloc_rtllib); EXPORT_SYMBOL(alloc_rtllib);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册