Skip to content

Commit 2e6bd24

Browse files
committed
wifi: mac80211: fix prep_connection error path
If prep_channel fails in prep_connection, the code releases the deflink's chanctx, which is wrong since we may be using a different link. It's already wrong to even do that always though, since we might still have the station. Remove it only if prep_channel succeeded and later updates fail. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240318184907.2780c1f08c3d.I033c9b15483933088f32a2c0789612a33dd33d82@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent ec50f31 commit 2e6bd24

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

net/mac80211/mlme.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7652,7 +7652,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
76527652
sdata_info(sdata,
76537653
"failed to insert STA entry for the AP (error %d)\n",
76547654
err);
7655-
goto out_err;
7655+
goto out_release_chan;
76567656
}
76577657
} else
76587658
WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid));
@@ -7663,8 +7663,9 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
76637663

76647664
return 0;
76657665

7666+
out_release_chan:
7667+
ieee80211_link_release_channel(link);
76667668
out_err:
7667-
ieee80211_link_release_channel(&sdata->deflink);
76687669
ieee80211_vif_set_links(sdata, 0, 0);
76697670
return err;
76707671
}

0 commit comments

Comments
 (0)