Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: mac80211: finish link init before RCU publish

Since the link/conf pointers can be accessed without any
protection other than RCU, make sure the data is actually
set up before publishing the structures.

Fixes: b2e8434f1829 ("wifi: mac80211: set up/tear down client vif links properly")
Link: https://patch.msgid.link/20250624130749.9a308b713c74.I4a80f5eead112a38730939ea591d2e275c721256@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+3 -3
+3 -3
net/mac80211/link.c
··· 93 93 if (link_id < 0) 94 94 link_id = 0; 95 95 96 - rcu_assign_pointer(sdata->vif.link_conf[link_id], link_conf); 97 - rcu_assign_pointer(sdata->link[link_id], link); 98 - 99 96 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { 100 97 struct ieee80211_sub_if_data *ap_bss; 101 98 struct ieee80211_bss_conf *ap_bss_conf; ··· 142 145 143 146 ieee80211_link_debugfs_add(link); 144 147 } 148 + 149 + rcu_assign_pointer(sdata->vif.link_conf[link_id], link_conf); 150 + rcu_assign_pointer(sdata->link[link_id], link); 145 151 } 146 152 147 153 void ieee80211_link_stop(struct ieee80211_link_data *link)