diff mbox

cfg80211: avoid mem leak on driver hint set

Message ID 1417688536-9145-1-git-send-email-arik@wizery.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Arik Nemtsov Dec. 4, 2014, 10:22 a.m. UTC
In the already-set and intersect case of a driver-hint, the previous
wiphy regdomain was not freed before being reset with a copy of the
cfg80211 regdomain.

Cc: stable@vger.kernel.org
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
---
 net/wireless/reg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Luis Chamberlain Dec. 4, 2014, 5:37 p.m. UTC | #1
On Thu, Dec 04, 2014 at 12:22:16PM +0200, Arik Nemtsov wrote:
> In the already-set and intersect case of a driver-hint, the previous
> wiphy regdomain was not freed before being reset with a copy of the
> cfg80211 regdomain.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>

Acked-by: Luis R. Rodriguez <mcgrof@suse.com>

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Dec. 12, 2014, 11:25 a.m. UTC | #2
On Thu, 2014-12-04 at 12:22 +0200, Arik Nemtsov wrote:
> In the already-set and intersect case of a driver-hint, the previous
> wiphy regdomain was not freed before being reset with a copy of the
> cfg80211 regdomain.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 004ea14..8941e1c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1916,7 +1916,7 @@  static enum reg_request_treatment
 reg_process_hint_driver(struct wiphy *wiphy,
 			struct regulatory_request *driver_request)
 {
-	const struct ieee80211_regdomain *regd;
+	const struct ieee80211_regdomain *regd, *tmp;
 	enum reg_request_treatment treatment;
 
 	treatment = __reg_process_hint_driver(driver_request);
@@ -1936,7 +1936,10 @@  reg_process_hint_driver(struct wiphy *wiphy,
 			reg_free_request(driver_request);
 			return REG_REQ_IGNORE;
 		}
+
+		tmp = get_wiphy_regdom(wiphy);
 		rcu_assign_pointer(wiphy->regd, regd);
+		rcu_free_regdom(tmp);
 	}