Skip to content

Commit 753aacf

Browse files
committed
nl80211: fix sched scan netlink socket owner destruction
A single netlink socket might own multiple interfaces *and* a scheduled scan request (which might belong to another interface), so when it goes away both may need to be destroyed. Remove the schedule_scan_stop indirection to fix this - it's only needed for interface destruction because of the way this works right now, with a single work taking care of all interfaces. Cc: [email protected] Fixes: 93a1e86 ("nl80211: Stop scheduled scan if netlink client disappears") Signed-off-by: Johannes Berg <[email protected]>
1 parent 35f432a commit 753aacf

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

net/wireless/nl80211.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14502,13 +14502,17 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
1450214502

1450314503
list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) {
1450414504
bool schedule_destroy_work = false;
14505-
bool schedule_scan_stop = false;
1450614505
struct cfg80211_sched_scan_request *sched_scan_req =
1450714506
rcu_dereference(rdev->sched_scan_req);
1450814507

1450914508
if (sched_scan_req && notify->portid &&
14510-
sched_scan_req->owner_nlportid == notify->portid)
14511-
schedule_scan_stop = true;
14509+
sched_scan_req->owner_nlportid == notify->portid) {
14510+
sched_scan_req->owner_nlportid = 0;
14511+
14512+
if (rdev->ops->sched_scan_stop &&
14513+
rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
14514+
schedule_work(&rdev->sched_scan_stop_wk);
14515+
}
1451214516

1451314517
list_for_each_entry_rcu(wdev, &rdev->wiphy.wdev_list, list) {
1451414518
cfg80211_mlme_unregister_socket(wdev, notify->portid);
@@ -14539,12 +14543,6 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
1453914543
spin_unlock(&rdev->destroy_list_lock);
1454014544
schedule_work(&rdev->destroy_work);
1454114545
}
14542-
} else if (schedule_scan_stop) {
14543-
sched_scan_req->owner_nlportid = 0;
14544-
14545-
if (rdev->ops->sched_scan_stop &&
14546-
rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
14547-
schedule_work(&rdev->sched_scan_stop_wk);
1454814546
}
1454914547
}
1455014548

0 commit comments

Comments
 (0)