From patchwork Thu Dec 4 10:22:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5437091 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 343FFBEEA8 for ; Thu, 4 Dec 2014 10:26:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70DB9202B8 for ; Thu, 4 Dec 2014 10:26:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7675420272 for ; Thu, 4 Dec 2014 10:26:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754382AbaLDKZN (ORCPT ); Thu, 4 Dec 2014 05:25:13 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35860 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753956AbaLDKWP (ORCPT ); Thu, 4 Dec 2014 05:22:15 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so34282116wiv.0 for ; Thu, 04 Dec 2014 02:22:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n413+MzAXDDBDVGonQCSjud34euxMhQ6Tj79MB14n0I=; b=js84Sehc0okYDjyDGerg184ejt9ahUgrrgZz2L5y6AOIW+uanyGaL7jYHQBTizkl04 n62hDzAKo4bjKqlC6PRXIFUpRwWQTH0FEm97erK61/zZf3YGOfroM72h02cvLKSm5r8q qI2622p5PK2qhCJ2MdriQYIdw7pMgoSZDc4w7CJie0fPDMdQwOlensmF9wGTlXcqQZX2 U8rbdWJsaAo0aH4kHh69QuaM20MeQlsQMOAS+UxSF9goYNFJHMQmXOTq2WIlEbL3xz11 NltceIscu6rEUrNLsk+zYprnuvQR1mLh3Zh5OSuz++FIrM7mq3zAvWZLjdiQHsfoMhCo Z3XA== X-Gm-Message-State: ALoCoQnGWnYis1W0g/rvxCUb71ymWlvfdP6uL/LdZDp9Q0Cv032aORGxJzPzdGQhRoema2z5Ah4g X-Received: by 10.180.82.226 with SMTP id l2mr9634416wiy.61.1417688533691; Thu, 04 Dec 2014 02:22:13 -0800 (PST) Received: from athena.amr.corp.intel.com (85-250-108-142.bb.netvision.net.il. [85.250.108.142]) by mx.google.com with ESMTPSA id nb8sm3926012wic.7.2014.12.04.02.22.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Dec 2014 02:22:13 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , "Luis R. Rodriguez" , Arik Nemtsov , stable@vger.kernel.org Subject: [PATCH] cfg80211: avoid mem leak on driver hint set Date: Thu, 4 Dec 2014 12:22:16 +0200 Message-Id: <1417688536-9145-1-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Luis R. Rodriguez --- net/wireless/reg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); }