All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Abinader <eduardo.abinader@riverbed.com>
To: linux-wireless@vger.kernel.org, johannes@sipsolutions.net
Cc: johannes.berg@intel.com
Subject: [PATCH] nl80211: avoid possible memleak on nl80211_set_reg
Date: Mon, 6 Jun 2016 16:46:36 +0200	[thread overview]
Message-ID: <57558CCC.7030800@riverbed.com> (raw)

Setting NULL just after freeing regdomain.

Signed-off-by: Eduardo Abinader <eduardo.abinader@riverbed.com>
---
  net/wireless/nl80211.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d120449..39d107d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5839,10 +5839,11 @@ static int nl80211_set_reg(struct sk_buff *skb, 
struct genl_info *info)

  	r = set_regdom(rd, REGD_SOURCE_CRDA);
  	/* set_regdom took ownership */
-	rd = NULL;

   bad_reg:
  	kfree(rd);
+	rd = NULL;
+
  	return r;
  }
  #endif /* CONFIG_CFG80211_CRDA_SUPPORT */
-- 
2.5.0

             reply	other threads:[~2016-06-06 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 14:46 Eduardo Abinader [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-06-06 14:56 [PATCH] nl80211: avoid possible memleak on nl80211_set_reg Eduardo Abinader
2016-06-09  7:58 ` Johannes Berg
2016-06-09  8:36   ` Arend Van Spriel
2016-06-09  8:39     ` 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=57558CCC.7030800@riverbed.com \
    --to=eduardo.abinader@riverbed.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.