Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 159730
b: refs/heads/master
c: 0ff6ce7
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Aug 20, 2009
1 parent 53225ce commit 0d4de72
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96909e97716de1d86e6e24d6aabce09980372771
refs/heads/master: 0ff6ce7b36199f67f709c750e9a2a66659a4babe
30 changes: 18 additions & 12 deletions trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,14 @@ void wiphy_unregister(struct wiphy *wiphy)
* get to lock contention here if userspace issues a command
* that identified the hardware by wiphy index.
*/
mutex_lock(&rdev->mtx);
/* unlock again before freeing */
mutex_unlock(&rdev->mtx);
cfg80211_lock_rdev(rdev);

if (WARN_ON(rdev->scan_req)) {
rdev->scan_req->aborted = true;
___cfg80211_scan_done(rdev);
}

cfg80211_unlock_rdev(rdev);

cfg80211_debugfs_rdev_del(rdev);

Expand All @@ -605,7 +610,6 @@ void wiphy_unregister(struct wiphy *wiphy)

flush_work(&rdev->scan_done_wk);
cancel_work_sync(&rdev->conn_work);
kfree(rdev->scan_req);
flush_work(&rdev->event_work);
}
EXPORT_SYMBOL(wiphy_unregister);
Expand Down Expand Up @@ -653,6 +657,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,

switch (state) {
case NETDEV_REGISTER:
/*
* NB: cannot take rdev->mtx here because this may be
* called within code protected by it when interfaces
* are added with nl80211.
*/
mutex_init(&wdev->mtx);
INIT_LIST_HEAD(&wdev->event_list);
spin_lock_init(&wdev->event_lock);
Expand Down Expand Up @@ -730,13 +739,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
#endif
break;
case NETDEV_UNREGISTER:
cfg80211_lock_rdev(rdev);

if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == dev)) {
rdev->scan_req->aborted = true;
___cfg80211_scan_done(rdev);
}

/*
* NB: cannot take rdev->mtx here because this may be
* called within code protected by it when interfaces
* are removed with nl80211.
*/
mutex_lock(&rdev->devlist_mtx);
/*
* It is possible to get NETDEV_UNREGISTER
Expand All @@ -755,7 +762,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
#endif
}
mutex_unlock(&rdev->devlist_mtx);
cfg80211_unlock_rdev(rdev);
break;
case NETDEV_PRE_UP:
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
Expand Down

0 comments on commit 0d4de72

Please sign in to comment.