Commit 3f61b7a3 authored by Johannes Berg's avatar Johannes Berg Committed by Johannes Berg

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: default avatarColin King <[email protected]>
Reported-by: default avatarDan Carpenter <[email protected]>
Signed-off-by: default avatarJohannes Berg <[email protected]>
Signed-off-by: Johannes Berg's avatarJohannes Berg <[email protected]>
parent 3c12d048
...@@ -3572,11 +3572,14 @@ static int __init init_mac80211_hwsim(void) ...@@ -3572,11 +3572,14 @@ static int __init init_mac80211_hwsim(void)
hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0); hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0);
if (!hwsim_wq) if (!hwsim_wq)
return -ENOMEM; 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); err = register_pernet_device(&hwsim_net_ops);
if (err) if (err)
return err; goto out_free_rht;
err = platform_driver_register(&mac80211_hwsim_driver); err = platform_driver_register(&mac80211_hwsim_driver);
if (err) if (err)
...@@ -3701,6 +3704,10 @@ static int __init init_mac80211_hwsim(void) ...@@ -3701,6 +3704,10 @@ static int __init init_mac80211_hwsim(void)
platform_driver_unregister(&mac80211_hwsim_driver); platform_driver_unregister(&mac80211_hwsim_driver);
out_unregister_pernet: out_unregister_pernet:
unregister_pernet_device(&hwsim_net_ops); unregister_pernet_device(&hwsim_net_ops);
return err; return err;
} }
module_init(init_mac80211_hwsim); module_init(init_mac80211_hwsim);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment