]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
cfg80211: regulatory: make initialization more robust
authorJohannes Berg <johannes.berg@intel.com>
Mon, 1 Oct 2018 09:43:00 +0000 (11:43 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3 ]

Since my change to split out the regulatory init to occur later,
any issues during earlier cfg80211_init() or errors during the
platform device allocation would lead to crashes later. Make this
more robust by checking that the earlier initialization succeeded.

Fixes: d7be102f2945 ("cfg80211: initialize regulatory keys/database later")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/wireless/reg.c

index f483b04918282a088cafed490517cbea2440accc..13a8e0e70f4d226c428742bf6ed413213c69afc1 100644 (file)
@@ -3695,6 +3695,15 @@ static int __init regulatory_init_db(void)
 {
        int err;
 
+       /*
+        * It's possible that - due to other bugs/issues - cfg80211
+        * never called regulatory_init() below, or that it failed;
+        * in that case, don't try to do any further work here as
+        * it's doomed to lead to crashes.
+        */
+       if (IS_ERR_OR_NULL(reg_pdev))
+               return -EINVAL;
+
        err = load_builtin_regdb_keys();
        if (err)
                return err;