Skip to content

Commit acc44cb

Browse files
benzeajmberg-intel
authored andcommitted
wifi: cfg80211: avoid double free if updating BSS fails
cfg80211_update_known_bss will always consume the passed IEs. As such, cfg80211_update_assoc_bss_entry also needs to always set the pointers to NULL so that no double free can occur. Note that hitting this would probably require being connected to a hidden BSS which is then doing a channel switch while also switching to be not hidden anymore at the same time. Signed-off-by: Benjamin Berg <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20231220133549.8891edb28d51.Id09c5145363e990ff5237decd58296302e2d53c8@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 31c5e92 commit acc44cb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

net/wireless/scan.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,10 +3194,9 @@ void cfg80211_update_assoc_bss_entry(struct wireless_dev *wdev,
31943194

31953195
if (new) {
31963196
/* to save time, update IEs for transmitting bss only */
3197-
if (cfg80211_update_known_bss(rdev, cbss, new, false)) {
3198-
new->pub.proberesp_ies = NULL;
3199-
new->pub.beacon_ies = NULL;
3200-
}
3197+
cfg80211_update_known_bss(rdev, cbss, new, false);
3198+
new->pub.proberesp_ies = NULL;
3199+
new->pub.beacon_ies = NULL;
32013200

32023201
list_for_each_entry_safe(nontrans_bss, tmp,
32033202
&new->pub.nontrans_list,

0 commit comments

Comments
 (0)