linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Sara Sharon <sara.sharon@intel.com>
Subject: [PATCH v8 13/15] cfg80211: fix memory leak of new_ie
Date: Fri,  8 Feb 2019 14:15:37 +0100	[thread overview]
Message-ID: <20190208131539.6813-13-johannes@sipsolutions.net> (raw)
In-Reply-To: <20190208131539.6813-1-johannes@sipsolutions.net>

From: Sara Sharon <sara.sharon@intel.com>

new_ie is used as a temporary storage for the generation of
the new elements. However, after copying from it the memory
wasn't freed and leaked. Free it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/wireless/scan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 46ecb10e85fb..287518c6caa4 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1576,10 +1576,8 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
 	if (!new_ie)
 		return;
 	new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, gfp);
-	if (!new_ies) {
-		kfree(new_ie);
-		return;
-	}
+	if (!new_ies)
+		goto out_free;
 
 	pos = new_ie;
 
@@ -1613,6 +1611,9 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
 		if (old)
 			kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head);
 	}
+
+out_free:
+	kfree(new_ie);
 }
 
 /* cfg80211_inform_bss_width_frame helper */
-- 
2.17.2


  parent reply	other threads:[~2019-02-08 13:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 13:15 [PATCH v8 01/15] mac80211: pass bssids to elements parsing function Johannes Berg
2019-02-08 13:15 ` [PATCH v8 02/15] mac80211: move the bss update from elements to an helper Johannes Berg
2019-02-08 13:15 ` [PATCH v8 03/15] cfg80211: Parsing of Multiple BSSID information in scanning Johannes Berg
2019-02-08 13:15 ` [PATCH v8 04/15] cfg80211: use for_each_element() for multi-bssid parsing Johannes Berg
2019-02-08 13:15 ` [PATCH v8 05/15] cfg80211: Properly track transmitting and non-transmitting BSS Johannes Berg
2019-02-08 13:15 ` [PATCH v8 06/15] cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible Johannes Berg
2019-02-08 13:15 ` [PATCH v8 07/15] cfg80211: parse multi-bssid only if HW supports it Johannes Berg
2019-02-08 13:15 ` [PATCH v8 08/15] cfg80211: make BSSID generation function inline Johannes Berg
2019-02-08 13:15 ` [PATCH v8 09/15] cfg80211: save multi-bssid properties Johannes Berg
2019-02-08 13:15 ` [PATCH v8 10/15] mac80211: support multi-bssid Johannes Berg
2019-02-08 13:15 ` [PATCH v8 11/15] mac80211: indicate support for multiple BSSID Johannes Berg
2019-02-08 13:15 ` [PATCH v8 12/15] cfg80211: fix the IE inheritance of extension IEs Johannes Berg
2019-02-08 13:15 ` Johannes Berg [this message]
2019-02-08 13:15 ` [PATCH v8 14/15] mac80211_hwsim: Declare support for Multi-BSSID Johannes Berg
2019-02-08 13:15 ` [PATCH v8 15/15] cfg80211: add missing kernel-doc for multi-BSSID fields Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190208131539.6813-13-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sara.sharon@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).