Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94c78cb4 authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80211: fix memory leak



My recent change here introduced a possible memory leak if the
driver registers an invalid cipher schemes. This won't really
happen in practice, but fix the leak nonetheless.

Fixes: e3a55b53 ("mac80211: validate cipher scheme PN length better")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 658358ce
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -770,10 +770,12 @@ static int ieee80211_init_cipher_suites(struct ieee80211_local *local)

		for (r = 0; r < local->hw.n_cipher_schemes; r++) {
			suites[w++] = cs[r].cipher;
			if (WARN_ON(cs[r].pn_len > IEEE80211_MAX_PN_LEN))
			if (WARN_ON(cs[r].pn_len > IEEE80211_MAX_PN_LEN)) {
				kfree(suites);
				return -EINVAL;
			}
		}
	}

	local->hw.wiphy->cipher_suites = suites;
	local->hw.wiphy->n_cipher_suites = w;