summaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2018-10-01 11:43:00 +0200
committerJohannes Berg <johannes.berg@intel.com>2018-10-02 09:58:25 +0200
commit71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3 (patch)
treecfbc9830c5747b76da5205ed4c5f6c02f4b9b865 /net/wireless/reg.c
parentc70616bd8a56a7ecb79c70b7454ce7f1909ff7e0 (diff)
downloadblackbird-op-linux-71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3.tar.gz
blackbird-op-linux-71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3.zip
cfg80211: regulatory: make initialization more robust
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>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 56be68a27bb9..d7b93a772edc 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -3829,6 +3829,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;
OpenPOWER on IntegriCloud