blob: 9bdc8884757adadeb082b7d8f1a5277be15a1368 [file] [log] [blame]
From 676ef8fc13469d0b06cf1c3f5db1ee9c08b91501 Mon Sep 17 00:00:00 2001
From: Navid Emamdoost <>
Date: Fri, 4 Oct 2019 14:42:19 -0500
Subject: [PATCH] nl80211: fix memory leak in nl80211_get_ftm_responder_stats
commit 1399c59fa92984836db90538cf92397fe7caaa57 upstream.
In nl80211_get_ftm_responder_stats, a new skb is created via nlmsg_new
named msg. If nl80211hdr_put() fails, then msg should be released. The
return statement should be replace by goto to error handling code.
Fixes: 81e54d08d9d8 ("cfg80211: support FTM responder configuration/statistics")
Signed-off-by: Navid Emamdoost <>
Signed-off-by: Johannes Berg <>
Signed-off-by: Paul Gortmaker <>
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index bc305873db90..07c9707cdb85 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -13467,7 +13467,7 @@ static int nl80211_get_ftm_responder_stats(struct sk_buff *skb,
hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
if (!hdr)
- return -ENOBUFS;
+ goto nla_put_failure;
if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex))
goto nla_put_failure;