summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2018-12-15 11:03:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-13 09:51:02 +0100
commit366fc5858720b749d52a32ec15c8420939092b2a (patch)
treeeb3d2807937485dc65ac0f54427fe6da0f814701 /net/wireless
parent098143bfc29e1709fab54891176325a346d9e100 (diff)
nl80211: fix memory leak if validate_pae_over_nl80211() fails
[ Upstream commit d350a0f431189517b1af0dbbb605c273231a8966 ] If validate_pae_over_nl80211() were to fail in nl80211_crypto_settings(), we might leak the 'connkeys' allocation. Fix this. Fixes: 64bf3d4bc2b0 ("nl80211: Add CONTROL_PORT_OVER_NL80211 attribute") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 176edfefcbaa..295cd8d5554f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8993,8 +8993,10 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) {
int r = validate_pae_over_nl80211(rdev, info);
- if (r < 0)
+ if (r < 0) {
+ kzfree(connkeys);
return r;
+ }
ibss.control_port_over_nl80211 = true;
}