nl80211: fix memory leak in nl80211_get_ftm_responder_stats
diff mbox series

Message ID 20191004194220.19412-1-navid.emamdoost@gmail.com
State Accepted
Delegated to: Johannes Berg
Headers show
Series
  • nl80211: fix memory leak in nl80211_get_ftm_responder_stats
Related show

Commit Message

Navid Emamdoost Oct. 4, 2019, 7:42 p.m. UTC
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 <navid.emamdoost@gmail.com>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Markus Elfring Oct. 5, 2019, 3:35 p.m. UTC | #1
> 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.

Please improve this change description (also by avoiding a typo).

Regards,
Markus

Patch
diff mbox series

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d21b1581a665..cecd3bf101f8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -13644,7 +13644,7 @@  static int nl80211_get_ftm_responder_stats(struct sk_buff *skb,
 	hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
 			     NL80211_CMD_GET_FTM_RESPONDER_STATS);
 	if (!hdr)
-		return -ENOBUFS;
+		goto nla_put_failure;
 
 	if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex))
 		goto nla_put_failure;