Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7de4ebac authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman
Browse files

mac80211: properly deal with station hashtable insert errors



commit 62b14b241ca6f790a17ccd9dd9f62ce1b006d406 upstream.

The original hand-implemented hash-table in mac80211 couldn't result
in insertion errors, and while converting to rhashtable I evidently
forgot to check the errors.

This surfaced now only because Ben is adding many identical keys and
that resulted in hidden insertion errors.

Fixes: 7bedd0cf ("mac80211: use rhashtable for station table")
Reported-by: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5f6e35c2
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -256,10 +256,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
}

/* Caller must hold local->sta_mtx */
static void sta_info_hash_add(struct ieee80211_local *local,
static int sta_info_hash_add(struct ieee80211_local *local,
			     struct sta_info *sta)
{
	rhashtable_insert_fast(&local->sta_hash, &sta->hash_node,
	return rhashtable_insert_fast(&local->sta_hash, &sta->hash_node,
				      sta_rht_params);
}

@@ -503,7 +503,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
	set_sta_flag(sta, WLAN_STA_BLOCK_BA);

	/* make the station visible */
	sta_info_hash_add(local, sta);
	err = sta_info_hash_add(local, sta);
	if (err)
		goto out_drop_sta;

	list_add_tail_rcu(&sta->list, &local->sta_list);

@@ -538,6 +540,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 out_remove:
	sta_info_hash_del(local, sta);
	list_del_rcu(&sta->list);
 out_drop_sta:
	local->num_sta--;
	synchronize_net();
	__cleanup_single_sta(sta);