diff options
author | Eliad Peller <eliad@wizery.com> | 2015-10-25 10:59:33 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-11-03 10:42:05 +0100 |
commit | 0d440ea294a00b60ced66c0bc5cb5caa42fd4fbd (patch) | |
tree | 0f8e7a81bc3843836a4557cb8adbe5d9a34ff34f /net/mac80211/scan.c | |
parent | 968a76cef3d1bb9a3b4d135cd788056e742859f3 (diff) |
mac80211: don't reconfigure sched scan in case of wowlan
Scheduled scan has to be reconfigured only if wowlan wasn't
configured, since otherwise it should continue to run (with
the 'any' trigger) or be aborted.
The current code will end up asking the driver to start a new
scheduled scan without stopping the previous one, and leaking
some memory (from the previous request.)
Fix this by doing the abort/restart under the proper conditions.
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index b64fd2b2d95a..4aeca4b0c3cb 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -1140,10 +1140,10 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, return ret; } -int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata) +int ieee80211_request_sched_scan_stop(struct ieee80211_local *local) { - struct ieee80211_local *local = sdata->local; - int ret = 0; + struct ieee80211_sub_if_data *sched_scan_sdata; + int ret = -ENOENT; mutex_lock(&local->mtx); @@ -1155,8 +1155,10 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata) /* We don't want to restart sched scan anymore. */ RCU_INIT_POINTER(local->sched_scan_req, NULL); - if (rcu_access_pointer(local->sched_scan_sdata)) { - ret = drv_sched_scan_stop(local, sdata); + sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, + lockdep_is_held(&local->mtx)); + if (sched_scan_sdata) { + ret = drv_sched_scan_stop(local, sched_scan_sdata); if (!ret) RCU_INIT_POINTER(local->sched_scan_sdata, NULL); } |