]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nl80211: fix memory leak if validate_pae_over_nl80211() fails
authorJohannes Berg <johannes.berg@intel.com>
Sat, 15 Dec 2018 09:03:22 +0000 (11:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jan 2019 08:51:02 +0000 (09:51 +0100)
[ 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>
net/wireless/nl80211.c

index 176edfefcbaa89d826c322eb52cfc4e12129dbd8..295cd8d5554f6a6981ba609f4ecb9fc88a81847c 100644 (file)
@@ -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;
        }