diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a3fb7dd743c8..d4a77f9fe0b7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7242,8 +7242,9 @@ enum ieee80211_ap_reg_power { * @mgmt_registrations_need_update: mgmt registrations were updated, * need to propagate the update to the driver * @address: The address for this device, valid only if @netdev is %NULL - * @is_running: true if this is a non-netdev device that has been started, e.g. - * the P2P Device. + * @is_running: true if the device has been started, e.g. the P2P Device; + * for netdevs, tracked under the wiphy mutex from NETDEV_UP until + * NETDEV_GOING_DOWN * @ps: powersave mode is enabled * @ps_timeout: dynamic powersave timeout * @unexpected_nlportid: (private) netlink port ID of application @@ -7407,8 +7408,6 @@ static inline const u8 *wdev_address(struct wireless_dev *wdev) static inline bool wdev_running(struct wireless_dev *wdev) { - if (wdev->netdev) - return netif_running(wdev->netdev); return wdev->is_running; } diff --git a/net/wireless/core.c b/net/wireless/core.c index 45a1709cffe7..fa56208f8c8e 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -1836,6 +1836,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, } break; case NETDEV_GOING_DOWN: + scoped_guard(wiphy, &rdev->wiphy) + wdev->is_running = false; cfg80211_leave(rdev, wdev, -1); scoped_guard(wiphy, &rdev->wiphy) { cfg80211_remove_links(wdev); @@ -1866,6 +1868,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, break; case NETDEV_UP: wiphy_lock(&rdev->wiphy); + wdev->is_running = true; cfg80211_update_iface_num(rdev, wdev->iftype, 1); switch (wdev->iftype) { #ifdef CONFIG_CFG80211_WEXT