@@ -1096,6 +1096,17 @@ void cfg80211_stop_iface(struct wiphy *wiphy,
struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_stop_iface);
+bool cfg80211_dev_in_list_rtnl(struct cfg80211_registered_device *rdev)
+{
+ struct cfg80211_registered_device *item;
+
+ list_for_each_entry(item, &cfg80211_rdev_list, list) {
+ if (item == rdev)
+ return true;
+ }
+ return false;
+}
+
static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
unsigned long state, void *ptr)
{
@@ -286,6 +286,7 @@ struct cfg80211_cqm_config {
int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
char *newname);
+bool cfg80211_dev_in_list_rtnl(struct cfg80211_registered_device *rdev);
void ieee80211_set_bitrate_flags(struct wiphy *wiphy);
@@ -129,16 +129,19 @@ static int wiphy_resume(struct device *dev)
struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
int ret = 0;
+ rtnl_lock();
+ if (!cfg80211_dev_in_list_rtnl(rdev))
+ goto done;
+
/* Age scan results with time spent in suspend */
cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at);
if (rdev->ops->resume) {
- rtnl_lock();
if (rdev->wiphy.registered)
ret = rdev_resume(rdev);
- rtnl_unlock();
}
-
+done:
+ rtnl_unlock();
return ret;
}