Skip to content

Commit 6b1ad5a

Browse files
committed
Merge tag 'mac80211-for-davem-2020-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
Johannes Berg says: ==================== Just a small update: * fix the deadlock on rfkill/wireless removal that a few people reported * fix an uninitialized variable * update wiki URLs ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents af7b480 + 59d4bfc commit 6b1ad5a

File tree

10 files changed

+38
-17
lines changed

10 files changed

+38
-17
lines changed

Documentation/networking/mac80211-injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ interface), along the following lines:::
101101

102102
You can also find a link to a complete inject application here:
103103

104-
http://wireless.kernel.org/en/users/Documentation/packetspammer
104+
https://wireless.wiki.kernel.org/en/users/Documentation/packetspammer
105105

106106
Andy Green <[email protected]>

Documentation/networking/regulatory.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ regulatory infrastructure works.
99

1010
More up to date information can be obtained at the project's web page:
1111

12-
http://wireless.kernel.org/en/developers/Regulatory
12+
https://wireless.wiki.kernel.org/en/developers/Regulatory
1313

1414
Keeping regulatory domains in userspace
1515
---------------------------------------
@@ -37,7 +37,7 @@ expected regulatory domains will be respected by the kernel.
3737
A currently available userspace agent which can accomplish this
3838
is CRDA - central regulatory domain agent. Its documented here:
3939

40-
http://wireless.kernel.org/en/developers/Regulatory/CRDA
40+
https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA
4141

4242
Essentially the kernel will send a udev event when it knows
4343
it needs a new regulatory domain. A udev rule can be put in place
@@ -58,7 +58,7 @@ Who asks for regulatory domains?
5858

5959
Users can use iw:
6060

61-
http://wireless.kernel.org/en/users/Documentation/iw
61+
https://wireless.wiki.kernel.org/en/users/Documentation/iw
6262

6363
An example::
6464

include/net/cfg80211.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5075,7 +5075,8 @@ struct cfg80211_cqm_config;
50755075
* by cfg80211 on change_interface
50765076
* @mgmt_registrations: list of registrations for management frames
50775077
* @mgmt_registrations_lock: lock for the list
5078-
* @mgmt_registrations_update_wk: update work to defer from atomic context
5078+
* @mgmt_registrations_need_update: mgmt registrations were updated,
5079+
* need to propagate the update to the driver
50795080
* @mtx: mutex used to lock data in this struct, may be used by drivers
50805081
* and some API functions require it held
50815082
* @beacon_interval: beacon interval used on this device for transmitting
@@ -5121,7 +5122,7 @@ struct wireless_dev {
51215122

51225123
struct list_head mgmt_registrations;
51235124
spinlock_t mgmt_registrations_lock;
5124-
struct work_struct mgmt_registrations_update_wk;
5125+
u8 mgmt_registrations_need_update:1;
51255126

51265127
struct mutex mtx;
51275128

include/uapi/linux/nl80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@
794794
* various triggers. These triggers can be configured through this
795795
* command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
796796
* more background information, see
797-
* http://wireless.kernel.org/en/users/Documentation/WoWLAN.
797+
* https://wireless.wiki.kernel.org/en/users/Documentation/WoWLAN.
798798
* The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
799799
* from the driver reporting the wakeup reason. In this case, the
800800
* @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason

net/mac80211/mlme.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
167167
ret = IEEE80211_STA_DISABLE_HT |
168168
IEEE80211_STA_DISABLE_VHT |
169169
IEEE80211_STA_DISABLE_HE;
170+
else
171+
ret = 0;
170172
vht_chandef = *chandef;
171173
goto out;
172174
}

net/mac80211/rx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4694,7 +4694,7 @@ void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
46944694
* rate_idx is MCS index, which can be [0-76]
46954695
* as documented on:
46964696
*
4697-
* http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n
4697+
* https://wireless.wiki.kernel.org/en/developers/Documentation/ieee80211/802.11n
46984698
*
46994699
* Anything else would be some sort of driver or
47004700
* hardware error. The driver should catch hardware

net/wireless/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ config CFG80211
3131

3232
For more information refer to documentation on the wireless wiki:
3333

34-
http://wireless.kernel.org/en/developers/Documentation/cfg80211
34+
https://wireless.wiki.kernel.org/en/developers/Documentation/cfg80211
3535

3636
When built as a module it will be called cfg80211.
3737

net/wireless/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
497497
INIT_WORK(&rdev->propagate_radar_detect_wk,
498498
cfg80211_propagate_radar_detect_wk);
499499
INIT_WORK(&rdev->propagate_cac_done_wk, cfg80211_propagate_cac_done_wk);
500+
INIT_WORK(&rdev->mgmt_registrations_update_wk,
501+
cfg80211_mgmt_registrations_update_wk);
500502

501503
#ifdef CONFIG_CFG80211_DEFAULT_PS
502504
rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
@@ -1047,6 +1049,7 @@ void wiphy_unregister(struct wiphy *wiphy)
10471049
flush_work(&rdev->sched_scan_stop_wk);
10481050
flush_work(&rdev->propagate_radar_detect_wk);
10491051
flush_work(&rdev->propagate_cac_done_wk);
1052+
flush_work(&rdev->mgmt_registrations_update_wk);
10501053

10511054
#ifdef CONFIG_PM
10521055
if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup)
@@ -1108,7 +1111,6 @@ static void __cfg80211_unregister_wdev(struct wireless_dev *wdev, bool sync)
11081111
rdev->devlist_generation++;
11091112

11101113
cfg80211_mlme_purge_registrations(wdev);
1111-
flush_work(&wdev->mgmt_registrations_update_wk);
11121114

11131115
switch (wdev->iftype) {
11141116
case NL80211_IFTYPE_P2P_DEVICE:
@@ -1253,8 +1255,6 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
12531255
spin_lock_init(&wdev->event_lock);
12541256
INIT_LIST_HEAD(&wdev->mgmt_registrations);
12551257
spin_lock_init(&wdev->mgmt_registrations_lock);
1256-
INIT_WORK(&wdev->mgmt_registrations_update_wk,
1257-
cfg80211_mgmt_registrations_update_wk);
12581258
INIT_LIST_HEAD(&wdev->pmsr_list);
12591259
spin_lock_init(&wdev->pmsr_lock);
12601260
INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);

net/wireless/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ struct cfg80211_registered_device {
9999
struct cfg80211_chan_def cac_done_chandef;
100100
struct work_struct propagate_cac_done_wk;
101101

102+
struct work_struct mgmt_registrations_update_wk;
103+
102104
/* must be last because of the way we do wiphy_priv(),
103105
* and it should at least be aligned to NETDEV_ALIGN */
104106
struct wiphy wiphy __aligned(NETDEV_ALIGN);

net/wireless/mlme.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,15 @@ static void cfg80211_mgmt_registrations_update(struct wireless_dev *wdev)
440440

441441
ASSERT_RTNL();
442442

443+
spin_lock_bh(&wdev->mgmt_registrations_lock);
444+
if (!wdev->mgmt_registrations_need_update) {
445+
spin_unlock_bh(&wdev->mgmt_registrations_lock);
446+
return;
447+
}
448+
443449
rcu_read_lock();
444450
list_for_each_entry_rcu(tmp, &rdev->wiphy.wdev_list, list) {
445-
list_for_each_entry_rcu(reg, &tmp->mgmt_registrations, list) {
451+
list_for_each_entry(reg, &tmp->mgmt_registrations, list) {
446452
u32 mask = BIT(le16_to_cpu(reg->frame_type) >> 4);
447453
u32 mcast_mask = 0;
448454

@@ -460,16 +466,23 @@ static void cfg80211_mgmt_registrations_update(struct wireless_dev *wdev)
460466
}
461467
rcu_read_unlock();
462468

469+
wdev->mgmt_registrations_need_update = 0;
470+
spin_unlock_bh(&wdev->mgmt_registrations_lock);
471+
463472
rdev_update_mgmt_frame_registrations(rdev, wdev, &upd);
464473
}
465474

466475
void cfg80211_mgmt_registrations_update_wk(struct work_struct *wk)
467476
{
468-
struct wireless_dev *wdev = container_of(wk, struct wireless_dev,
469-
mgmt_registrations_update_wk);
477+
struct cfg80211_registered_device *rdev;
478+
struct wireless_dev *wdev;
479+
480+
rdev = container_of(wk, struct cfg80211_registered_device,
481+
mgmt_registrations_update_wk);
470482

471483
rtnl_lock();
472-
cfg80211_mgmt_registrations_update(wdev);
484+
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list)
485+
cfg80211_mgmt_registrations_update(wdev);
473486
rtnl_unlock();
474487
}
475488

@@ -557,6 +570,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,
557570
nreg->multicast_rx = multicast_rx;
558571
list_add(&nreg->list, &wdev->mgmt_registrations);
559572
}
573+
wdev->mgmt_registrations_need_update = 1;
560574
spin_unlock_bh(&wdev->mgmt_registrations_lock);
561575

562576
cfg80211_mgmt_registrations_update(wdev);
@@ -585,7 +599,8 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)
585599
list_del(&reg->list);
586600
kfree(reg);
587601

588-
schedule_work(&wdev->mgmt_registrations_update_wk);
602+
wdev->mgmt_registrations_need_update = 1;
603+
schedule_work(&rdev->mgmt_registrations_update_wk);
589604
}
590605

591606
spin_unlock_bh(&wdev->mgmt_registrations_lock);
@@ -608,6 +623,7 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
608623
list_del(&reg->list);
609624
kfree(reg);
610625
}
626+
wdev->mgmt_registrations_need_update = 1;
611627
spin_unlock_bh(&wdev->mgmt_registrations_lock);
612628

613629
cfg80211_mgmt_registrations_update(wdev);

0 commit comments

Comments
 (0)