diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2022-04-07 12:36:58 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-04-11 15:11:57 +0200 |
commit | 450c271d508f47577cce509582f1041eeb947e6e (patch) | |
tree | 1002bd2cf2854c86187b6f1cc8a7c666ab00c563 /net/mac80211 | |
parent | 92bbf95df7683d3ab1ab1aa3aaa029c5c5870591 (diff) | |
download | linux-450c271d508f47577cce509582f1041eeb947e6e.tar.gz linux-450c271d508f47577cce509582f1041eeb947e6e.tar.bz2 linux-450c271d508f47577cce509582f1041eeb947e6e.zip |
mac80211: protect ieee80211_assign_beacon with next_beacon check
Even if it is not a real issue since ieee80211_set_after_csa_beacon()
or ieee80211_set_after_color_change_beacon() are run only when csa or bcc
is active, move next_beacon check before running ieee80211_assign_beacon
routine.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/041764ed7e9781bcee66c33b41f1365aa4205932.1649327683.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index ba752539d1d9..8e14ff53e4bd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3306,13 +3306,14 @@ static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata, switch (sdata->vif.type) { case NL80211_IFTYPE_AP: + if (!sdata->u.ap.next_beacon) + return -EINVAL; + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, NULL, NULL); - if (sdata->u.ap.next_beacon) { - kfree(sdata->u.ap.next_beacon->mbssid_ies); - kfree(sdata->u.ap.next_beacon); - sdata->u.ap.next_beacon = NULL; - } + kfree(sdata->u.ap.next_beacon->mbssid_ies); + kfree(sdata->u.ap.next_beacon); + sdata->u.ap.next_beacon = NULL; if (err < 0) return err; @@ -4314,13 +4315,14 @@ ieee80211_set_after_color_change_beacon(struct ieee80211_sub_if_data *sdata, case NL80211_IFTYPE_AP: { int ret; + if (!sdata->u.ap.next_beacon) + return -EINVAL; + ret = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, NULL, NULL); - if (sdata->u.ap.next_beacon) { - kfree(sdata->u.ap.next_beacon->mbssid_ies); - kfree(sdata->u.ap.next_beacon); - sdata->u.ap.next_beacon = NULL; - } + kfree(sdata->u.ap.next_beacon->mbssid_ies); + kfree(sdata->u.ap.next_beacon); + sdata->u.ap.next_beacon = NULL; if (ret < 0) return ret; |