summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-09 09:47:27 +0100
committerJohannes Berg <johannes.berg@intel.com>2012-11-09 09:48:43 +0100
commitcfff2f999d9baa561f20d999c8b83b03f078fb8f (patch)
tree66e04272e2b723beb8ab60c413864bc562888ea1 /net
parent987c285c2ae2e4e32aca3a9b3252d28171c75711 (diff)
downloadlinux-cfff2f999d9baa561f20d999c8b83b03f078fb8f.tar.gz
linux-cfff2f999d9baa561f20d999c8b83b03f078fb8f.tar.bz2
linux-cfff2f999d9baa561f20d999c8b83b03f078fb8f.zip
mac80211: fix memory leak in device registration error path
If the cipher suites need to be allocated, but this allocation fails, this leaks the internal scan request. Fix that by going to the correct error handling label. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index c80c4490351c..f57f597972f8 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -871,8 +871,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
local->hw.wiphy->cipher_suites,
sizeof(u32) * local->hw.wiphy->n_cipher_suites,
GFP_KERNEL);
- if (!suites)
- return -ENOMEM;
+ if (!suites) {
+ result = -ENOMEM;
+ goto fail_wiphy_register;
+ }
for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
u32 suite = local->hw.wiphy->cipher_suites[r];
if (suite == WLAN_CIPHER_SUITE_WEP40 ||