From patchwork Fri Jun 21 05:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkateswara Naralasetty X-Patchwork-Id: 11008437 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E71714E5 for ; Fri, 21 Jun 2019 05:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4320928720 for ; Fri, 21 Jun 2019 05:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3560D288C4; Fri, 21 Jun 2019 05:14:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 01B0128720 for ; Fri, 21 Jun 2019 05:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XDYQU7XtyAo8zJc3el1L//ueD4I2+yrYCq1y+DLOURQ=; b=fZr yRNWh6yHYt60CF2pacuLzNTOoFz+WQqdAtk3650urkN3au0JZ5EPtIz/X352xWPB2CsGjpTPydnko siaKzIfqUV/BGg4ts01F2NxTLfqh9d/tPGbUJblUt/nFndp5AHeMo2o02U9KggxjRGqeDL0YOej1e 35J638Z5BViXF1aJHmorBASb0F5HTp9tLuAByLqVowr+Iq9T70PazDTlqCSd+COgpbbP2ZwbmjG4X vNxEOueydpxHGkDHH9oexboH5sVHN42LYj1evWJVps3dPrYdFhruO59quX/LYJz2mTbz4wsX79VJr SBvsuF7QBxnksxoT/zgPSXm7yHUUH0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1heBs6-0003V4-Fd; Fri, 21 Jun 2019 05:13:58 +0000 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1heBs3-0003Uj-JB for ath11k@lists.infradead.org; Fri, 21 Jun 2019 05:13:57 +0000 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 21 Jun 2019 10:43:51 +0530 X-IronPort-AV: E=McAfee;i="6000,8403,9294"; a="10387193" Received: from vnaralas-linux.qualcomm.com ([10.201.26.231]) by ironmsg01-blr.qualcomm.com with ESMTP; 21 Jun 2019 10:43:47 +0530 Received: by vnaralas-linux.qualcomm.com (Postfix, from userid 443942) id 29B7D1695; Fri, 21 Jun 2019 10:43:45 +0530 (IST) From: Venkateswara Naralasetty To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: fix possible mem leak in extd tx stats Date: Fri, 21 Jun 2019 10:43:44 +0530 Message-Id: <1561094024-32433-1-git-send-email-vnaralas@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_221356_064038_9FBF3EC5 X-CRM114-Status: UNSURE ( 7.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Venkateswara Naralasetty MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fix the memory leak in extd tx stats. Signed-off-by: Venkateswara Naralasetty --- drivers/net/wireless/ath/ath11k/mac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index c1e9c34..586c725 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2597,8 +2597,10 @@ static int ath11k_sta_state(struct ieee80211_hw *hw, if (ath11k_debug_is_extd_tx_stats_enabled(ar)) { arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); - if (!arsta->tx_stats) + if (!arsta->tx_stats) { + ret = -ENOMEM; goto exit; + } } if (ieee80211_vif_is_mesh(vif)) { @@ -2634,8 +2636,8 @@ static int ath11k_sta_state(struct ieee80211_hw *hw, ath11k_mac_dec_num_stations(arvif, sta); - if (ath11k_debug_is_extd_tx_stats_enabled(ar)) - kfree(arsta->tx_stats); + kfree(arsta->tx_stats); + arsta->tx_stats = NULL; kfree(arsta->rx_stats); arsta->rx_stats = NULL;