netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: Fix possible leak in nl80211_new_interface on MONITOR_FLAG_ACTIVE
@ 2015-02-14 19:52 Christian Engelmayer
  2015-02-24  9:58 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Engelmayer @ 2015-02-14 19:52 UTC (permalink / raw)
  To: johannes-cdvu00un1VgdHxzADdlk8Q
  Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Christian Engelmayer

In case of NL80211_IFTYPE_MONITOR and flag MONITOR_FLAG_ACTIVE, the already
allocated sk_buff 'msg' is not freed, when the function exits in case the
feature is not supported. Detected by Coverity CID 1269116.

Signed-off-by: Christian Engelmayer <cengelma-RbZlAiThDcE@public.gmane.org>
---
Compile tested only. Applies against linux-next.
---
 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 d78fd8b54515..38a7477dda81 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2663,8 +2663,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
 				  &flags);
 
 	if (!err && (flags & MONITOR_FLAG_ACTIVE) &&
-	    !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR))
+	    !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) {
+		nlmsg_free(msg);
 		return -EOPNOTSUPP;
+	}
 
 	wdev = rdev_add_virtual_intf(rdev,
 				nla_data(info->attrs[NL80211_ATTR_IFNAME]),
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] nl80211: Fix possible leak in nl80211_new_interface on MONITOR_FLAG_ACTIVE
  2015-02-14 19:52 [PATCH] nl80211: Fix possible leak in nl80211_new_interface on MONITOR_FLAG_ACTIVE Christian Engelmayer
@ 2015-02-24  9:58 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-02-24  9:58 UTC (permalink / raw)
  To: Christian Engelmayer; +Cc: davem, netdev, linux-wireless

On Sat, 2015-02-14 at 20:52 +0100, Christian Engelmayer wrote:
> In case of NL80211_IFTYPE_MONITOR and flag MONITOR_FLAG_ACTIVE, the already
> allocated sk_buff 'msg' is not freed, when the function exits in case the
> feature is not supported. Detected by Coverity CID 1269116.
> 
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
> ---
> Compile tested only. Applies against linux-next.

Thanks for the report. I've fixed this in a different way.

johannes

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

end of thread, other threads:[~2015-02-24  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-14 19:52 [PATCH] nl80211: Fix possible leak in nl80211_new_interface on MONITOR_FLAG_ACTIVE Christian Engelmayer
2015-02-24  9:58 ` Johannes Berg

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