mptcp: dedicated request sock for subflow in v6
[platform/kernel/linux-rpi.git] / net / wireless / reg.c
index df87c7f..d0fbe82 100644 (file)
@@ -806,6 +806,8 @@ static int __init load_builtin_regdb_keys(void)
        return 0;
 }
 
+MODULE_FIRMWARE("regulatory.db.p7s");
+
 static bool regdb_has_valid_signature(const u8 *data, unsigned int size)
 {
        const struct firmware *sig;
@@ -1077,8 +1079,12 @@ static void regdb_fw_cb(const struct firmware *fw, void *context)
        release_firmware(fw);
 }
 
+MODULE_FIRMWARE("regulatory.db");
+
 static int query_regdb_file(const char *alpha2)
 {
+       int err;
+
        ASSERT_RTNL();
 
        if (regdb)
@@ -1088,9 +1094,13 @@ static int query_regdb_file(const char *alpha2)
        if (!alpha2)
                return -ENOMEM;
 
-       return request_firmware_nowait(THIS_MODULE, true, "regulatory.db",
-                                      &reg_pdev->dev, GFP_KERNEL,
-                                      (void *)alpha2, regdb_fw_cb);
+       err = request_firmware_nowait(THIS_MODULE, true, "regulatory.db",
+                                     &reg_pdev->dev, GFP_KERNEL,
+                                     (void *)alpha2, regdb_fw_cb);
+       if (err)
+               kfree(alpha2);
+
+       return err;
 }
 
 int reg_reload_regdb(void)
@@ -2338,6 +2348,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
        struct cfg80211_chan_def chandef = {};
        struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
        enum nl80211_iftype iftype;
+       bool ret;
 
        wdev_lock(wdev);
        iftype = wdev->iftype;
@@ -2387,7 +2398,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
        case NL80211_IFTYPE_AP:
        case NL80211_IFTYPE_P2P_GO:
        case NL80211_IFTYPE_ADHOC:
-               return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
+               wiphy_lock(wiphy);
+               ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
+               wiphy_unlock(wiphy);
+
+               return ret;
        case NL80211_IFTYPE_STATION:
        case NL80211_IFTYPE_P2P_CLIENT:
                return cfg80211_chandef_usable(wiphy, &chandef,
@@ -4232,8 +4247,10 @@ static int __init regulatory_init_db(void)
                return -EINVAL;
 
        err = load_builtin_regdb_keys();
-       if (err)
+       if (err) {
+               platform_device_unregister(reg_pdev);
                return err;
+       }
 
        /* We always try to get an update for the static regdomain */
        err = regulatory_hint_core(cfg80211_world_regdom->alpha2);