Commit f36fe0a2 authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: mac80211: fix up link station creation/insertion



When we create a station with a non-default link, then
we should have a link address, and we definitely need
to insert it into the link hash table on insertion.

Split the API into with and without link creation and
if it has a link, insert the link into the link hash
table on sta_info_insert().

Fixes: ba6ddab9 ("wifi: mac80211: maintain link-sta hash table")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d46ffecf
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1850,8 +1850,14 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
	    !sdata->u.mgd.associated)
		return -EINVAL;

	sta = sta_info_alloc(sdata, mac, params->link_sta_params.link_id,
	if (params->link_sta_params.link_id >= 0)
		sta = sta_info_alloc_with_link(sdata, mac,
					       params->link_sta_params.link_id,
					       params->link_sta_params.link_mac,
					       GFP_KERNEL);
	else
		sta = sta_info_alloc(sdata, mac, GFP_KERNEL);

	if (!sta)
		return -ENOMEM;

+2 −2
Original line number Diff line number Diff line
@@ -625,7 +625,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
	scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
	rcu_read_unlock();

	sta = sta_info_alloc(sdata, addr, -1, GFP_KERNEL);
	sta = sta_info_alloc(sdata, addr, GFP_KERNEL);
	if (!sta) {
		rcu_read_lock();
		return NULL;
@@ -1226,7 +1226,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
	scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
	rcu_read_unlock();

	sta = sta_info_alloc(sdata, addr, -1, GFP_ATOMIC);
	sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
	if (!sta)
		return;

+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ __mesh_sta_info_alloc(struct ieee80211_sub_if_data *sdata, u8 *hw_addr)
	if (aid < 0)
		return NULL;

	sta = sta_info_alloc(sdata, hw_addr, -1, GFP_KERNEL);
	sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL);
	if (!sta)
		return NULL;

+1 −1
Original line number Diff line number Diff line
@@ -5909,7 +5909,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
	}

	if (!have_sta) {
		new_sta = sta_info_alloc(sdata, cbss->bssid, -1, GFP_KERNEL);
		new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
		if (!new_sta)
			return -ENOMEM;
	}
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
	scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
	rcu_read_unlock();

	sta = sta_info_alloc(sdata, addr, -1, GFP_ATOMIC);
	sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
	if (!sta)
		return;

Loading