]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nl80211: fix station_info pertid memory leak
authorAndy Strohman <andrew@andrewstrohman.com>
Sat, 25 May 2019 06:27:29 +0000 (23:27 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 May 2019 07:47:10 +0000 (09:47 +0200)
When dumping stations, memory allocated for station_info's
pertid member will leak if the nl80211 header cannot be added to
the sk_buff due to insufficient tail room.

I noticed this leak in the kmalloc-2048 cache.

Cc: stable@vger.kernel.org
Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
Signed-off-by: Andy Strohman <andy@uplevelsystems.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index 4b3c5281ca14178da296ef67b4c8ea8baf4192ba..140d24e5718f397f15fe9f871559d3f2094430fa 100644 (file)
@@ -4859,8 +4859,10 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
        struct nlattr *sinfoattr, *bss_param;
 
        hdr = nl80211hdr_put(msg, portid, seq, flags, cmd);
-       if (!hdr)
+       if (!hdr) {
+               cfg80211_sinfo_release_content(sinfo);
                return -1;
+       }
 
        if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
            nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr) ||