summaryrefslogtreecommitdiff
path: root/net/mac80211/main.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-05-20 09:31:47 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2015-05-20 09:37:38 (GMT)
commit94c78cb4523c246ec37959436f04e7c946f7494b (patch)
tree7ecdc49abe145736cb9123e73c3756f1b6d4bfb3 /net/mac80211/main.c
parent658358cec93a7130615cfc1d6843ab07e49625e6 (diff)
downloadlinux-94c78cb4523c246ec37959436f04e7c946f7494b.tar.xz
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: e3a55b5399d55 ("mac80211: validate cipher scheme PN length better") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r--net/mac80211/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 3c956c5..99d27ba 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -770,8 +770,10 @@ 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;
+ }
}
}