]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.44/nl80211-fix-sched-scan-netlink-socket-owner-destruction.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.44 / nl80211-fix-sched-scan-netlink-socket-owner-destruction.patch
1 From 753aacfd2e95df6a0caf23c03dc309020765bea9 Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Thu, 5 Jan 2017 10:57:14 +0100
4 Subject: nl80211: fix sched scan netlink socket owner destruction
5
6 From: Johannes Berg <johannes.berg@intel.com>
7
8 commit 753aacfd2e95df6a0caf23c03dc309020765bea9 upstream.
9
10 A single netlink socket might own multiple interfaces *and* a
11 scheduled scan request (which might belong to another interface),
12 so when it goes away both may need to be destroyed.
13
14 Remove the schedule_scan_stop indirection to fix this - it's only
15 needed for interface destruction because of the way this works
16 right now, with a single work taking care of all interfaces.
17
18 Fixes: 93a1e86ce10e4 ("nl80211: Stop scheduled scan if netlink client disappears")
19 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 net/wireless/nl80211.c | 16 +++++++---------
24 1 file changed, 7 insertions(+), 9 deletions(-)
25
26 --- a/net/wireless/nl80211.c
27 +++ b/net/wireless/nl80211.c
28 @@ -13168,13 +13168,17 @@ static int nl80211_netlink_notify(struct
29
30 list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) {
31 bool schedule_destroy_work = false;
32 - bool schedule_scan_stop = false;
33 struct cfg80211_sched_scan_request *sched_scan_req =
34 rcu_dereference(rdev->sched_scan_req);
35
36 if (sched_scan_req && notify->portid &&
37 - sched_scan_req->owner_nlportid == notify->portid)
38 - schedule_scan_stop = true;
39 + sched_scan_req->owner_nlportid == notify->portid) {
40 + sched_scan_req->owner_nlportid = 0;
41 +
42 + if (rdev->ops->sched_scan_stop &&
43 + rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
44 + schedule_work(&rdev->sched_scan_stop_wk);
45 + }
46
47 list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) {
48 cfg80211_mlme_unregister_socket(wdev, notify->portid);
49 @@ -13205,12 +13209,6 @@ static int nl80211_netlink_notify(struct
50 spin_unlock(&rdev->destroy_list_lock);
51 schedule_work(&rdev->destroy_work);
52 }
53 - } else if (schedule_scan_stop) {
54 - sched_scan_req->owner_nlportid = 0;
55 -
56 - if (rdev->ops->sched_scan_stop &&
57 - rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
58 - schedule_work(&rdev->sched_scan_stop_wk);
59 }
60 }
61