Commit 3a5a7cd8 authored by Johannes Berg's avatar Johannes Berg Committed by Jiri Slaby

mac80211: properly flush delayed scan work on interface removal

commit 46238845 upstream.

When an interface is deleted, an ongoing hardware scan is canceled and
the driver must abort the scan, at the very least reporting completion
while the interface is removed.

However, if it scheduled the work that might only run after everything
is said and done, which leads to cfg80211 warning that the scan isn't
reported as finished yet; this is no fault of the driver, it already
did, but mac80211 hasn't processed it.

To fix this situation, flush the delayed work when the interface being
removed is the one that was executing the scan.
Reported-by: default avatarSujith Manoharan <sujith@msujith.org>
Tested-by: default avatarSujith Manoharan <sujith@msujith.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 4d2ff0c7
...@@ -749,10 +749,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, ...@@ -749,10 +749,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
u32 hw_reconf_flags = 0; u32 hw_reconf_flags = 0;
int i, flushed; int i, flushed;
struct ps_data *ps; struct ps_data *ps;
bool cancel_scan;
clear_bit(SDATA_STATE_RUNNING, &sdata->state); clear_bit(SDATA_STATE_RUNNING, &sdata->state);
if (rcu_access_pointer(local->scan_sdata) == sdata) cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
if (cancel_scan)
ieee80211_scan_cancel(local); ieee80211_scan_cancel(local);
/* /*
...@@ -959,6 +961,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, ...@@ -959,6 +961,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
ieee80211_recalc_ps(local, -1); ieee80211_recalc_ps(local, -1);
if (cancel_scan)
flush_delayed_work(&local->scan_work);
if (local->open_count == 0) { if (local->open_count == 0) {
ieee80211_stop_device(local); ieee80211_stop_device(local);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment