diff options
-rw-r--r-- | net/wireless/core.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 755cdf1643c9..1493285b6a4d 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -725,15 +725,22 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
725 | break; | 725 | break; |
726 | case NETDEV_UNREGISTER: | 726 | case NETDEV_UNREGISTER: |
727 | mutex_lock(&rdev->devlist_mtx); | 727 | mutex_lock(&rdev->devlist_mtx); |
728 | /* | ||
729 | * It is possible to get NETDEV_UNREGISTER | ||
730 | * multiple times. To detect that, check | ||
731 | * that the interface is still on the list | ||
732 | * of registered interfaces, and only then | ||
733 | * remove and clean it up. | ||
734 | */ | ||
728 | if (!list_empty(&wdev->list)) { | 735 | if (!list_empty(&wdev->list)) { |
729 | sysfs_remove_link(&dev->dev.kobj, "phy80211"); | 736 | sysfs_remove_link(&dev->dev.kobj, "phy80211"); |
730 | list_del_init(&wdev->list); | 737 | list_del_init(&wdev->list); |
731 | } | 738 | mutex_destroy(&wdev->mtx); |
732 | mutex_unlock(&rdev->devlist_mtx); | ||
733 | mutex_destroy(&wdev->mtx); | ||
734 | #ifdef CONFIG_WIRELESS_EXT | 739 | #ifdef CONFIG_WIRELESS_EXT |
735 | kfree(wdev->wext.keys); | 740 | kfree(wdev->wext.keys); |
736 | #endif | 741 | #endif |
742 | } | ||
743 | mutex_unlock(&rdev->devlist_mtx); | ||
737 | break; | 744 | break; |
738 | case NETDEV_PRE_UP: | 745 | case NETDEV_PRE_UP: |
739 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) | 746 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) |