Skip to content

Commit

Permalink
mac80211: fix possible memory leak in ieee80211_assign_beacon
Browse files Browse the repository at this point in the history
Free new beacon_data in ieee80211_assign_beacon whenever
ieee80211_assign_beacon fails

Fixes: 8860020 ("cfg80211: restructure AP/GO mode API")
Fixes: bc84797 ("mac80211: support FTM responder configuration/statistic")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Link: https://lore.kernel.org/r/770285772543c9fca33777bb4ad4760239e56256.1562105631.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
LorenzoBianconi authored and jmberg-intel committed Jul 20, 2019
1 parent 5edaac0 commit bcc27fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,10 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,

err = ieee80211_set_probe_resp(sdata, params->probe_resp,
params->probe_resp_len, csa);
if (err < 0)
if (err < 0) {
kfree(new);
return err;
}
if (err == 0)
changed |= BSS_CHANGED_AP_PROBE_RESP;

Expand All @@ -949,8 +951,10 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
params->civicloc,
params->civicloc_len);

if (err < 0)
if (err < 0) {
kfree(new);
return err;
}

changed |= BSS_CHANGED_FTM_RESPONDER;
}
Expand Down

0 comments on commit bcc27fa

Please sign in to comment.