Skip to content

Commit 230d33e

Browse files
jmberg-intelgregkh
authored andcommitted
wifi: mac80211: fix userspace_selectors corruption
[ Upstream commit 700014d ] Spotted during code review, the selectors need to be large enough for a 128-bit bitmap, not a single unsigned long, otherwise we have stack corruption. We should also allow passing selectors from userspace, but that should be a separate change. Signed-off-by: Johannes Berg <[email protected]> Reviewed-by: Ilan Peer <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250308225541.8f1bcf96a504.Ibeb8970c82a30c97279a4cc4e68faca5df1813a5@changeid Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9ed1182 commit 230d33e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

net/mac80211/mlme.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9648,8 +9648,6 @@ EXPORT_SYMBOL(ieee80211_disable_rssi_reports);
96489648

96499649
static void ieee80211_ml_reconf_selectors(unsigned long *userspace_selectors)
96509650
{
9651-
*userspace_selectors = 0;
9652-
96539651
/* these selectors are mandatory for ML reconfiguration */
96549652
set_bit(BSS_MEMBERSHIP_SELECTOR_SAE_H2E, userspace_selectors);
96559653
set_bit(BSS_MEMBERSHIP_SELECTOR_HE_PHY, userspace_selectors);
@@ -9669,7 +9667,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata,
96699667
sdata->u.mgd.reconf.removed_links;
96709668
u16 link_mask, valid_links;
96719669
unsigned int link_id;
9672-
unsigned long userspace_selectors;
9670+
unsigned long userspace_selectors[BITS_TO_LONGS(128)] = {};
96739671
size_t orig_len = len;
96749672
u8 i, group_key_data_len;
96759673
u8 *pos;
@@ -9777,7 +9775,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata,
97779775
}
97789776

97799777
ieee80211_vif_set_links(sdata, valid_links, sdata->vif.dormant_links);
9780-
ieee80211_ml_reconf_selectors(&userspace_selectors);
9778+
ieee80211_ml_reconf_selectors(userspace_selectors);
97819779
link_mask = 0;
97829780
for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
97839781
struct cfg80211_bss *cbss = add_links_data->link[link_id].bss;
@@ -9823,7 +9821,7 @@ void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata,
98239821
link->u.mgd.conn = add_links_data->link[link_id].conn;
98249822
if (ieee80211_prep_channel(sdata, link, link_id, cbss,
98259823
true, &link->u.mgd.conn,
9826-
&userspace_selectors)) {
9824+
userspace_selectors)) {
98279825
link_info(link, "mlo: reconf: prep_channel failed\n");
98289826
goto disconnect;
98299827
}
@@ -10152,14 +10150,14 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,
1015210150
*/
1015310151
if (added_links) {
1015410152
bool uapsd_supported;
10155-
unsigned long userspace_selectors;
10153+
unsigned long userspace_selectors[BITS_TO_LONGS(128)] = {};
1015610154

1015710155
data = kzalloc(sizeof(*data), GFP_KERNEL);
1015810156
if (!data)
1015910157
return -ENOMEM;
1016010158

1016110159
uapsd_supported = true;
10162-
ieee80211_ml_reconf_selectors(&userspace_selectors);
10160+
ieee80211_ml_reconf_selectors(userspace_selectors);
1016310161
for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS;
1016410162
link_id++) {
1016510163
struct ieee80211_supported_band *sband;
@@ -10235,7 +10233,7 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,
1023510233
data->link[link_id].bss,
1023610234
true,
1023710235
&data->link[link_id].conn,
10238-
&userspace_selectors);
10236+
userspace_selectors);
1023910237
if (err)
1024010238
goto err_free;
1024110239
}

0 commit comments

Comments
 (0)