Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
authorJohn W. Linville <linville@tuxdriver.com>
Mon, 5 Dec 2011 16:05:44 +0000 (11:05 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 5 Dec 2011 16:05:44 +0000 (11:05 -0500)
1  2 
net/mac80211/util.c
net/wireless/reg.c

diff --combined net/mac80211/util.c
@@@ -13,7 -13,6 +13,7 @@@
  
  #include <net/mac80211.h>
  #include <linux/netdevice.h>
 +#include <linux/export.h>
  #include <linux/types.h>
  #include <linux/slab.h>
  #include <linux/skbuff.h>
@@@ -1039,7 -1038,6 +1039,6 @@@ int ieee80211_reconfig(struct ieee80211
                                             struct ieee80211_sub_if_data,
                                             u.ap);
  
-                       memset(&sta->sta.drv_priv, 0, hw->sta_data_size);
                        WARN_ON(drv_sta_add(local, sdata, &sta->sta));
                }
        }
diff --combined net/wireless/reg.c
  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  
  #include <linux/kernel.h>
 +#include <linux/export.h>
  #include <linux/slab.h>
  #include <linux/list.h>
  #include <linux/random.h>
  #include <linux/ctype.h>
  #include <linux/nl80211.h>
  #include <linux/platform_device.h>
 +#include <linux/moduleparam.h>
  #include <net/cfg80211.h>
  #include "core.h"
  #include "reg.h"
  #define REG_DBG_PRINT(args...)
  #endif
  
+ static struct regulatory_request core_request_world = {
+       .initiator = NL80211_REGDOM_SET_BY_CORE,
+       .alpha2[0] = '0',
+       .alpha2[1] = '0',
+       .intersect = false,
+       .processed = true,
+       .country_ie_env = ENVIRON_ANY,
+ };
  /* Receipt of information from last regulatory request */
- static struct regulatory_request *last_request;
+ static struct regulatory_request *last_request = &core_request_world;
  
  /* To trigger userspace events */
  static struct platform_device *reg_pdev;
@@@ -150,7 -157,7 +159,7 @@@ static char user_alpha2[2]
  module_param(ieee80211_regdom, charp, 0444);
  MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
  
- static void reset_regdomains(void)
+ static void reset_regdomains(bool full_reset)
  {
        /* avoid freeing static information or freeing something twice */
        if (cfg80211_regdomain == cfg80211_world_regdom)
  
        cfg80211_world_regdom = &world_regdom;
        cfg80211_regdomain = NULL;
+       if (!full_reset)
+               return;
+       if (last_request != &core_request_world)
+               kfree(last_request);
+       last_request = &core_request_world;
  }
  
  /*
@@@ -175,7 -189,7 +191,7 @@@ static void update_world_regdomain(cons
  {
        BUG_ON(!last_request);
  
-       reset_regdomains();
+       reset_regdomains(false);
  
        cfg80211_world_regdom = rd;
        cfg80211_regdomain = rd;
@@@ -1407,7 -1421,8 +1423,8 @@@ static int __regulatory_hint(struct wip
        }
  
  new_request:
-       kfree(last_request);
+       if (last_request != &core_request_world)
+               kfree(last_request);
  
        last_request = pending_request;
        last_request->intersect = intersect;
@@@ -1577,9 -1592,6 +1594,6 @@@ static int regulatory_hint_core(const c
  {
        struct regulatory_request *request;
  
-       kfree(last_request);
-       last_request = NULL;
        request = kzalloc(sizeof(struct regulatory_request),
                          GFP_KERNEL);
        if (!request)
@@@ -1777,7 -1789,7 +1791,7 @@@ static void restore_regulatory_settings
        mutex_lock(&cfg80211_mutex);
        mutex_lock(&reg_mutex);
  
-       reset_regdomains();
+       reset_regdomains(true);
        restore_alpha2(alpha2, reset_user);
  
        /*
@@@ -2037,8 -2049,10 +2051,10 @@@ static int __set_regdom(const struct ie
        }
  
        request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
-       if (!request_wiphy) {
-               reg_set_request_processed();
+       if (!request_wiphy &&
+           (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER ||
+            last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) {
+               schedule_delayed_work(&reg_timeout, 0);
                return -ENODEV;
        }
  
                int r;
  
                if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) {
-                       reset_regdomains();
+                       reset_regdomains(false);
                        cfg80211_regdomain = rd;
                        return 0;
                }
                if (r)
                        return r;
  
-               reset_regdomains();
+               reset_regdomains(false);
                cfg80211_regdomain = rd;
                return 0;
        }
  
                rd = NULL;
  
-               reset_regdomains();
+               reset_regdomains(false);
                cfg80211_regdomain = intersected_rd;
  
                return 0;
        kfree(rd);
        rd = NULL;
  
-       reset_regdomains();
+       reset_regdomains(false);
        cfg80211_regdomain = intersected_rd;
  
        return 0;
@@@ -2265,11 -2279,8 +2281,8 @@@ void /* __init_or_exit */ regulatory_ex
        mutex_lock(&cfg80211_mutex);
        mutex_lock(&reg_mutex);
  
-       reset_regdomains();
-       kfree(last_request);
+       reset_regdomains(true);
  
-       last_request = NULL;
        dev_set_uevent_suppress(&reg_pdev->dev, true);
  
        platform_device_unregister(reg_pdev);