Skip to content

Commit 1ac6f60

Browse files
committed
wifi: mac80211: mlme: fix memory leak
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 <[email protected]> Link: https://msgid.link/20240418105220.458421e3bbff.Icb5b84cba3ea420794cf009cf18ec3d76e434736@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 645acc6 commit 1ac6f60

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/mac80211/mlme.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,10 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
753753
}
754754

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

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

0 commit comments

Comments
 (0)