linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	"Franky Lin" <frankyl@broadcom.com>,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 19/19] brcm80211: fmac: release bss struct returned from cfg80211_inform_bss
Date: Thu, 10 Nov 2011 20:30:34 +0100	[thread overview]
Message-ID: <1320953434-16859-21-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1320953434-16859-1-git-send-email-arend@broadcom.com>

From: Franky Lin <frankyl@broadcom.com>

Referenced struct returned by cfg80211_inform_bss must be released with
cfg80211_put_bss to avoid memory leak.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 73be2c8..cc19a73 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -2049,10 +2049,10 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
 		notify_timestamp, notify_capability, notify_interval, notify_ie,
 		notify_ielen, notify_signal, GFP_KERNEL);
 
-	if (!bss) {
-		WL_ERR("cfg80211_inform_bss_frame error\n");
-		return -EINVAL;
-	}
+	if (!bss)
+		return -ENOMEM;
+
+	cfg80211_put_bss(bss);
 
 	return err;
 }
@@ -2096,6 +2096,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
 	struct ieee80211_channel *notify_channel;
 	struct brcmf_bss_info_le *bi = NULL;
 	struct ieee80211_supported_band *band;
+	struct cfg80211_bss *bss;
 	u8 *buf = NULL;
 	s32 err = 0;
 	u16 channel;
@@ -2149,10 +2150,17 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
 	WL_CONN("signal: %d\n", notify_signal);
 	WL_CONN("notify_timestamp: %#018llx\n", notify_timestamp);
 
-	cfg80211_inform_bss(wiphy, notify_channel, bssid,
+	bss = cfg80211_inform_bss(wiphy, notify_channel, bssid,
 		notify_timestamp, notify_capability, notify_interval,
 		notify_ie, notify_ielen, notify_signal, GFP_KERNEL);
 
+	if (!bss) {
+		err = -ENOMEM;
+		goto CleanUp;
+	}
+
+	cfg80211_put_bss(bss);
+
 CleanUp:
 
 	kfree(buf);
-- 
1.7.5.4



      parent reply	other threads:[~2011-11-10 19:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 19:30 [PATCH 00/19] brcm80211: cleanup and preparing for new chip Arend van Spriel
2011-11-10 19:30 ` Arend van Spriel
2011-11-10 19:34   ` Arend van Spriel
2011-11-10 19:30 ` [PATCH 01/19] brcm80211: smac: fix endianess issue for OTP memory access Arend van Spriel
2011-11-10 19:30 ` [PATCH 02/19] brcm80211: smac: remove code under unused macro definitions Arend van Spriel
2011-11-10 19:30 ` [PATCH 03/19] brcm80211: smac: replace own access category definitions with mac80211 enum Arend van Spriel
2011-11-10 19:30 ` [PATCH 04/19] brcm80211: smac: remove duplicate definition of D11_PHY_HDR_LEN Arend van Spriel
2011-11-10 19:30 ` [PATCH 05/19] brcm80211: smac: don't modify sta parameters when adding sta Arend van Spriel
2011-11-10 19:30 ` [PATCH 06/19] brcm80211: fmac: add iscoreup function for bcm4330 chip Arend van Spriel
2011-11-10 19:30 ` [PATCH 07/19] brcm80211: fmac: add corerev " Arend van Spriel
2011-11-10 19:30 ` [PATCH 08/19] brcm80211: fmac: add coredisable " Arend van Spriel
2011-11-10 19:30 ` [PATCH 09/19] brcm80211: fmac: add resetcore " Arend van Spriel
2011-11-10 19:30 ` [PATCH 10/19] brcm80211: fmac: remove id retrieve code Arend van Spriel
2011-11-10 19:30 ` [PATCH 11/19] brcm80211: smac: remove usage of brcmu_pkttotlen Arend van Spriel
2011-11-10 19:30 ` [PATCH 12/19] brcm80211: util: use sk_buff_head in precedence queue functions Arend van Spriel
2011-11-10 19:30 ` [PATCH 13/19] brcm80211: smac: combine promiscuous mode functionality Arend van Spriel
2011-11-10 19:30 ` [PATCH 14/19] brcm80211: util: move brcmu_pkttotlen() function to brcmfmac Arend van Spriel
2011-11-10 19:30 ` [PATCH 15/19] brcm80211: util: remove pointer traversal from brcmu_pkt_buf_free_skb Arend van Spriel
2011-11-10 19:30 ` [PATCH 16/19] brcm80211: fmac: add function to free the glom skb queue Arend van Spriel
2011-11-10 19:30 ` [PATCH 17/19] brcm80211: fmac: stop using hard coded firmware/nvram name Arend van Spriel
2011-11-11 17:35   ` John W. Linville
2011-11-11 19:49     ` Franky Lin
2011-11-10 19:30 ` [PATCH 18/19] brcm80211: fmac: remove PCMCIA core related code Arend van Spriel
2011-11-10 19:30 ` Arend van Spriel [this message]

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=1320953434-16859-21-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=frankyl@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).