When a remain-on-channel item is deleted, we remove it
from the list and then start the next item. However,
if it wasn't actually the first item then calling
ieee80211_start_next_roc() is wrong as it will start
the first item -- even if that was already started.
Fix the two places that do this and add a warning to
prevent the problem from reoccurring.
Reported-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
 
                list_del(&found->list);
 
-               ieee80211_start_next_roc(local);
+               if (found->started)
+                       ieee80211_start_next_roc(local);
                mutex_unlock(&local->mtx);
 
                ieee80211_roc_notify_destroy(found);
 
        roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work,
                               list);
 
+       if (WARN_ON_ONCE(roc->started))
+               return;
+
        if (local->ops->remain_on_channel) {
                int ret, duration = roc->duration;
 
 
                ieee80211_recalc_idle(local);
 
-               ieee80211_start_next_roc(local);
+               if (roc->started)
+                       ieee80211_start_next_roc(local);
        }
 
  out_unlock: