* [PATCH] netlink: fix station_info pertid memory leak
@ 2019-05-25 6:27 Andy Strohman
2019-05-27 4:16 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Andy Strohman @ 2019-05-25 6:27 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, Andy Strohman
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.
Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
Signed-off-by: Andy Strohman <andy@uplevelsystems.com>
---
net/wireless/nl80211.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fffe4b371e23..a82ecfe14d8d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4855,8 +4855,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) ||
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] netlink: fix station_info pertid memory leak
2019-05-25 6:27 [PATCH] netlink: fix station_info pertid memory leak Andy Strohman
@ 2019-05-27 4:16 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-05-27 4:16 UTC (permalink / raw)
To: Andy Strohman; +Cc: johannes, linux-wireless, Andy Strohman
Andy Strohman <andrew@andrewstrohman.com> writes:
> 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.
>
> Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
> Signed-off-by: Andy Strohman <andy@uplevelsystems.com>
> ---
> net/wireless/nl80211.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
The correct prefix should be "nl80211:".
--
Kalle Valo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-27 4:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-25 6:27 [PATCH] netlink: fix station_info pertid memory leak Andy Strohman
2019-05-27 4:16 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox