Skip to content

Commit 883b8dc

Browse files
rafaelmsoaresjmberg-intel
authored andcommitted
wifi: mac80211: mlme: Fix missing unlock on beacon RX
Commit 98b0b46 ("wifi: mac80211: mlme: use correct link_sta") switched to link station instead of deflink and added some checks to do that, which are done with the 'sta_mtx' mutex held. However, the error path of these checks does not unlock 'sta_mtx' before returning. Fixes: 98b0b46 ("wifi: mac80211: mlme: use correct link_sta") Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com> Link: https://lore.kernel.org/r/20220924184042.778676-1-rafaelmendsr@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent be92292 commit 883b8dc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/mac80211/mlme.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5589,12 +5589,16 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
55895589

55905590
mutex_lock(&local->sta_mtx);
55915591
sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr);
5592-
if (WARN_ON(!sta))
5592+
if (WARN_ON(!sta)) {
5593+
mutex_unlock(&local->sta_mtx);
55935594
goto free;
5595+
}
55945596
link_sta = rcu_dereference_protected(sta->link[link->link_id],
55955597
lockdep_is_held(&local->sta_mtx));
5596-
if (WARN_ON(!link_sta))
5598+
if (WARN_ON(!link_sta)) {
5599+
mutex_unlock(&local->sta_mtx);
55975600
goto free;
5601+
}
55985602

55995603
changed |= ieee80211_recalc_twt_req(link, link_sta, elems);
56005604

0 commit comments

Comments
 (0)