linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Fix memory leak in cfg80211_inform_single_bss_frame_data
@ 2019-10-27 18:15 Navid Emamdoost
  2019-10-28 12:12 ` Johannes Berg
  2019-11-04  8:25 ` [cfg80211] 17e52ab494: stack_segment:#[##] kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-27 18:15 UTC (permalink / raw)
  Cc: emamd001, smccaman, kjlu, Navid Emamdoost, Johannes Berg,
	David S. Miller, linux-wireless, netdev, linux-kernel

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


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

end of thread, other threads:[~2019-11-04  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 18:15 [PATCH] cfg80211: Fix memory leak in cfg80211_inform_single_bss_frame_data Navid Emamdoost
2019-10-28 12:12 ` Johannes Berg
2019-10-28 14:46   ` Navid Emamdoost
2019-11-04  8:25 ` [cfg80211] 17e52ab494: stack_segment:#[##] kernel test robot

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