linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: fix memory leak in nl80211_get_ftm_responder_stats
@ 2019-10-04 19:42 Navid Emamdoost
  2019-10-05 15:35 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-10-04 19:42 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Johannes Berg,
	David S. Miller, linux-wireless, netdev, linux-kernel

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(-)

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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nl80211: fix memory leak in nl80211_get_ftm_responder_stats
  2019-10-04 19:42 [PATCH] nl80211: fix memory leak in nl80211_get_ftm_responder_stats Navid Emamdoost
@ 2019-10-05 15:35 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-10-05 15:35 UTC (permalink / raw)
  To: Navid Emamdoost, linux-wireless, netdev
  Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, David S. Miller,
	Johannes Berg, linux-kernel, kernel-janitors

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-05 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 19:42 [PATCH] nl80211: fix memory leak in nl80211_get_ftm_responder_stats Navid Emamdoost
2019-10-05 15:35 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).