Skip to content

Commit

Permalink
mac80211: properly flush delayed scan work on interface removal
Browse files Browse the repository at this point in the history
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.

Cc: [email protected]
Reported-by: Sujith Manoharan <[email protected]>
Tested-by: Sujith Manoharan <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg authored and jmberg-intel committed Oct 30, 2014
1 parent ff1e417 commit 4623884
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
int i, flushed;
struct ps_data *ps;
struct cfg80211_chan_def chandef;
bool cancel_scan;

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);

/*
Expand Down Expand Up @@ -992,6 +994,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,

ieee80211_recalc_ps(local, -1);

if (cancel_scan)
flush_delayed_work(&local->scan_work);

if (local->open_count == 0) {
ieee80211_stop_device(local);

Expand Down

0 comments on commit 4623884

Please sign in to comment.