linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@umn.edu, smccaman@umn.edu, kjlu@umn.edu,
	Navid Emamdoost <navid.emamdoost@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] cfg80211: Fix memory leak in cfg80211_inform_single_bss_frame_data
Date: Sun, 27 Oct 2019 13:15:59 -0500	[thread overview]
Message-ID: <20191027181600.11149-1-navid.emamdoost@gmail.com> (raw)

In the implementation of cfg80211_inform_single_bss_frame_data() the
allocated memory for ies is leaked in case of an error. Release ies if
cfg80211_bss_update() fails.

Fixes: 2a5193119269 ("cfg80211/nl80211: scanning (and mac80211 update to use it)")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 net/wireless/scan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index aef240fdf8df..fae5af24f668 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1856,8 +1856,10 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy,
 		wiphy->max_adj_channel_rssi_comp;
 	res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid,
 				  jiffies);
-	if (!res)
+	if (!res) {
+		kfree(ies);
 		return NULL;
+	}
 
 	if (channel->band == NL80211_BAND_60GHZ) {
 		bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
-- 
2.17.1


             reply	other threads:[~2019-10-27 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27 18:15 Navid Emamdoost [this message]
2019-10-28 12:12 ` [PATCH] cfg80211: Fix memory leak in cfg80211_inform_single_bss_frame_data Johannes Berg
2019-10-28 14:46   ` Navid Emamdoost
2019-11-04  8:25 ` [cfg80211] 17e52ab494: stack_segment:#[##] kernel test robot

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=20191027181600.11149-1-navid.emamdoost@gmail.com \
    --to=navid.emamdoost@gmail.com \
    --cc=davem@davemloft.net \
    --cc=emamd001@umn.edu \
    --cc=johannes@sipsolutions.net \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=smccaman@umn.edu \
    /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).