Skip to content

Commit

Permalink
wifi: mac80211: mlme: fix memory leak
Browse files Browse the repository at this point in the history
When re-parsing the elements here (with changed mode), free
the original ones first to avoid leaking memory.

Fixes: 310c838 ("wifi: mac80211: clean up connection process")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240418105220.458421e3bbff.Icb5b84cba3ea420794cf009cf18ec3d76e434736@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Apr 19, 2024
1 parent 645acc6 commit 1ac6f60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,10 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
}

/* the mode can only decrease, so this must terminate */
if (ap_mode != conn->mode)
if (ap_mode != conn->mode) {
kfree(elems);
goto again;
}

mlme_link_id_dbg(sdata, link_id,
"connecting with %s mode, max bandwidth %d MHz\n",
Expand Down

0 comments on commit 1ac6f60

Please sign in to comment.