Received: by 10.213.65.68 with SMTP id h4csp2092357imn; Thu, 5 Apr 2018 08:51:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pA8fB1NVx86k5mOgDVnaDGGsRLx93a2qgE0LT2+YPjkIG4YDHiqizkvYaNjK2TqaAqPFh X-Received: by 10.98.69.142 with SMTP id n14mr17467548pfi.42.1522943484180; Thu, 05 Apr 2018 08:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522943484; cv=none; d=google.com; s=arc-20160816; b=GbK2ZKd8j1RaBhAAxCCZEMt9iDz/XvafP0csMd7E7qlUSPwQqb0rOFP0D55XD9+rbl 7Zz90pc2BPhGNseO7ATrcmZ75ytLJC4gZ40dzydlLKjf4jP+pFRKJeyiy3KC6tY2rhAu HiALpEziHbZ307Wsi4wLiEIVeW5bZ+4Z/nVK3Ufw+SAKgV+yderpYiiIp8fU3i04//L7 LMj4or5wy8d0iQvJ5alFduOs/fLJZu1Kocpsk5XLoZ3NWQY3x3O4aSKmWE3WKnebrCM5 qJn1NPOSUAulTHF3jgKH5QyfZYrtbMYlZUxBlzSORXGFWPM/bJNew9UeRm+tz1nGrY+N uXkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=gSOAZ3ciroJNmNI83jfXRba9/qIxl3iMQUz1FdqJwu0=; b=lXvhABaeM9X8EUY7B3loSPUw8zR6IrD9Y5pdhmGU+2G+KG27rXrt5rMSBR2efLhahC mH6Kog6L3RUkHUgbk1D7pNyQfkQ4cLcCJv68s9Ew6ZFzdzYCNU0I2ATJSP6BO3/eWjLt MyHCExadqUK6N/1wk3sVwt3PBBLTy3gjKW0IEtMe+gFl2vWgzGKF/sIF0HhfsSkg6atp sLtNwvLyI7NU1Uoy5OQxo8kOcryHmdSdLKrVWoVxfA5lJdq03b+1d8cgTQoC+AVjVWiV FAE4Grx4mDNlojvcdkMz+OKN11an3Fk9aFwUmPXIqVs1ew1nnLithXGeSzzaCNyWz5Xn Z98Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8-v6si7211571pll.146.2018.04.05.08.51.09; Thu, 05 Apr 2018 08:51:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751530AbeDEPtx (ORCPT + 99 others); Thu, 5 Apr 2018 11:49:53 -0400 Received: from gateway34.websitewelcome.com ([192.185.148.231]:46966 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbeDEPtw (ORCPT ); Thu, 5 Apr 2018 11:49:52 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 5813414A34E1 for ; Thu, 5 Apr 2018 10:49:51 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 4795f35pkcGlp4795foS2B; Thu, 05 Apr 2018 10:49:51 -0500 Received: from [189.145.54.187] (port=41644 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1f4794-004Mku-Sr; Thu, 05 Apr 2018 10:49:50 -0500 Date: Thu, 5 Apr 2018 10:49:49 -0500 From: "Gustavo A. R. Silva" To: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich , Kalle Valo Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler Message-ID: <20180405154949.GA32223@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.145.54.187 X-Source-L: No X-Exim-ID: 1f4794-004Mku-Sr X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.145.54.187]:41644 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case memory resources for fw were succesfully allocated, release them before jumping to fw_load_fail. Addresses-Coverity-ID: 1466092 ("Resource leak") Fixes: c3b2f7ca4186 ("qtnfmac: implement asynchronous firmware loading") Signed-off-by: Gustavo A. R. Silva --- drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index f117904..6c1e139 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -1185,6 +1185,10 @@ static void qtnf_fw_work_handler(struct work_struct *work) if (qtnf_poll_state(&priv->bda->bda_ep_state, QTN_EP_FW_LOADRDY, QTN_FW_DL_TIMEOUT_MS)) { pr_err("card is not ready\n"); + + if (!flashboot) + release_firmware(fw); + goto fw_load_fail; } -- 2.7.4