Skip to content

Commit

Permalink
cfg80211: call cfg80211_destroy_ifaces() with wiphy lock held
Browse files Browse the repository at this point in the history
This is needed since it calls into the driver, which must have the
same context as if we got to destroy an interface through nl80211.
Fix this, and add a direct lockdep assertion so we don't see it
pop up only when the driver calls back to cfg80211.

Fixes: a05829a ("cfg80211: avoid holding the RTNL when calling the driver")
Reported-by: syzbot+4305e814f9b267131776@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20210128183454.d31df9cbd7ce.I1beb07c9492f0ade900e864a098c57041e7a7ebf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jan 28, 2021
1 parent c88f952 commit 776a39b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev)
struct wireless_dev *wdev, *tmp;

ASSERT_RTNL();
lockdep_assert_wiphy(&rdev->wiphy);

list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) {
if (wdev->nl_owner_dead)
Expand All @@ -349,7 +350,9 @@ static void cfg80211_destroy_iface_wk(struct work_struct *work)
destroy_work);

rtnl_lock();
wiphy_lock(&rdev->wiphy);
cfg80211_destroy_ifaces(rdev);
wiphy_unlock(&rdev->wiphy);
rtnl_unlock();
}

Expand Down

0 comments on commit 776a39b

Please sign in to comment.