From patchwork Fri Mar 18 02:29:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Calaby X-Patchwork-Id: 8615911 X-Patchwork-Delegate: kvalo@adurom.com 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2B028C0553 for ; Fri, 18 Mar 2016 02:29:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 546ED20351 for ; Fri, 18 Mar 2016 02:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68F232034F for ; Fri, 18 Mar 2016 02:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752758AbcCRC30 (ORCPT ); Thu, 17 Mar 2016 22:29:26 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35709 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752643AbcCRC3Y (ORCPT ); Thu, 17 Mar 2016 22:29:24 -0400 Received: by mail-pf0-f175.google.com with SMTP id n5so146113239pfn.2 for ; Thu, 17 Mar 2016 19:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nzRTqcyC6OO22UG01kloTL/tu24xOfK1lbVQEHZW4v4=; b=svlbV7XzvFouIVDH5PKwITY9oUUy0kn8LexfDgecisdAsUa/pfpj6OSaoMTzyO5ebR 3MHc6T1B/tIrdmbvaEK6PgfR5lrSiUAzknSr56T13ZM1A3CmYwPobpADOaCcUAuZruJ1 FC4UyjjVclLnmfocDfrgY0adjVDKfzS/vXTjUgp7uEYWfjT0bASogNr58ipnXHGMkmML Ymh4iWN8Uceg3T5n0Wgq1FNicUkUJQZmjl7ZuBfHeRdLWBaXqtDmHP4ic6xmGYg81YAX YL9iMHfh4eGlYi8pKVqugqF9zYS33GnBryROK2p6ZvcystgUet7f43PTQA2lrpipq3fu x8hA== 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:in-reply-to :references; bh=nzRTqcyC6OO22UG01kloTL/tu24xOfK1lbVQEHZW4v4=; b=Fz2spv/rOoqr83UBD5TykDhue1wNFoc+O+20nwnWv9TB5VLyP4EltnSA9r9VmxY7IE 6brgv4CmZKkbGBmMT+Kw5TEJlsx/NXgC9F5trxt/o2zXkDd/EVTjiioFmh+Gk73JHxOs 2mUElGWJqUnfkfiMYRXRD7ZrN81YEIZwl70mqktkYqa1EzSAVJR5LeVbZBH4vk6jMefg bf4xpFxg63iFzh9f6xRvV0H0BWmJ6PKVtI4IMPA26tvlIfMmAKrIdXSHH9tYBT5/NcGO vv7qG7FOwJVRguiMf0zDIuai6xKYybLGxwYD+DSNOnD+vywyiikyGxT4/0BOEQwpjPpL VKFw== X-Gm-Message-State: AD7BkJIPj3nkCf868VJfjGWrM/efHDqsHYm2Hwd+wCwRafP5JSICosgQceMuPJ2uRZ0QHw== X-Received: by 10.98.87.200 with SMTP id i69mr19776414pfj.63.1458268158579; Thu, 17 Mar 2016 19:29:18 -0700 (PDT) Received: from multimedia.lan (C-59-101-14-180.hay.connect.net.au. [59.101.14.180]) by smtp.gmail.com with ESMTPSA id 82sm16378105pfi.78.2016.03.17.19.29.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Mar 2016 19:29:18 -0700 (PDT) From: Julian Calaby To: Kalle Valo Cc: Stanislaw Gruszka , Johannes Berg , Sara Sharon , Emmanuel Grumbach , linux-wireless@vger.kernel.org, Jia-Ju Bai Subject: [PATCH MOREWORK 18/19] iwl4965: Fix more memory leaks in __il4965_up() Date: Fri, 18 Mar 2016 13:29:11 +1100 Message-Id: <6bec5a9b55f13d40c2803f0fa60173451d5ea14a.1458262312.git.julian.calaby@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: References: 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 some of the non-success return paths, the memory allocated by iwl4965_sta_alloc_lq() in iwl4965_alloc_bcast_station() is not freed. In particular: - if the card isn't ready after il4965_prepare_card_hw() - if the card is hardware-rfkilled In the hardware rfkilled path, the driver enables the rfkill interrupt. When the card is unrfkilled and this interrupt is raised we end up calling il4965_bg_restart() which calls __il4965_up() which calls iwl4965_alloc_bcast_station() again. Suggested-by: Jia-Ju Bai Signed-off-by: Julian Calaby Acked-by: Stanislaw Gruszka --- This is only compile tested as I don't have compatible hardware. I also don't know the driver enough to know that this is truly correct - however it looks right and I stand by my analysis. Could someone else please review this? Thanks, Julian Calaby --- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index 30d9dd3..f9ed480 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -5553,6 +5553,7 @@ __il4965_up(struct il_priv *il) il4965_prepare_card_hw(il); if (!il->hw_ready) { + il_dealloc_bcast_stations(il); IL_ERR("HW not ready\n"); return -EIO; } @@ -5564,6 +5565,7 @@ __il4965_up(struct il_priv *il) set_bit(S_RFKILL, &il->status); wiphy_rfkill_set_hw_state(il->hw->wiphy, true); + il_dealloc_bcast_stations(il); il_enable_rfkill_int(il); IL_WARN("Radio disabled by HW RF Kill switch\n"); return 0;