mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
mac80211_hwsim: fix module init error paths
We didn't free the workqueue on any errors, nor did we correctly check for rhashtable allocation errors, nor did we free the hashtable on error. Reported-by: Colin King <colin.king@canonical.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
This commit is contained in:
parent
3c12d04868
commit
3f61b7a30a
1 changed files with 9 additions and 2 deletions
|
@ -3572,11 +3572,14 @@ static int __init init_mac80211_hwsim(void)
|
|||
hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0);
|
||||
if (!hwsim_wq)
|
||||
return -ENOMEM;
|
||||
rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params);
|
||||
|
||||
err = rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params);
|
||||
if (err)
|
||||
goto out_free_wq;
|
||||
|
||||
err = register_pernet_device(&hwsim_net_ops);
|
||||
if (err)
|
||||
return err;
|
||||
goto out_free_rht;
|
||||
|
||||
err = platform_driver_register(&mac80211_hwsim_driver);
|
||||
if (err)
|
||||
|
@ -3701,6 +3704,10 @@ static int __init init_mac80211_hwsim(void)
|
|||
platform_driver_unregister(&mac80211_hwsim_driver);
|
||||
out_unregister_pernet:
|
||||
unregister_pernet_device(&hwsim_net_ops);
|
||||
out_free_rht:
|
||||
rhashtable_destroy(&hwsim_radios_rht);
|
||||
out_free_wq:
|
||||
destroy_workqueue(hwsim_wq);
|
||||
return err;
|
||||
}
|
||||
module_init(init_mac80211_hwsim);
|
||||
|
|
Loading…
Reference in a new issue