Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2647422imj; Mon, 11 Feb 2019 06:25:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYb4OmLrPmwf1lI7BQJPHK7IEdyYSAbeAOBLa3qvZ19hGSrVVU1Z9OrdXVgr6AuphQMPjO3 X-Received: by 2002:a63:7044:: with SMTP id a4mr33274692pgn.359.1549895159756; Mon, 11 Feb 2019 06:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895159; cv=none; d=google.com; s=arc-20160816; b=QnzuJKOkZJSQxDh45HlczbHlTF9RORE+3jjp40RButaZHOLerMMseN90z+9jZ0BmXZ cj93ZcQKNJWXwznsJEYVa34kyY37ojCW3HOWjH86wBykffT7CCK/mTOVrVpKXz1A0d2I Y8Gg4reV5Qujs2CpEDDrzcFXN34NhbJOGSoMZmr1kP9DD8r+chjEvviwolZZqr3QgDhf PJl/u78d0Vc6u1tl2qbkGW9nwcZtFAovBh2YRAVYZgG9bSikI+yCs/9xYq+655Ei8psl FU8tMWwM3AsUJ1OpfMPDgrzv3mEfy8/kMZin+Vd911Ot/ZVAPH8bH2Hd5vwP8KrEr1vC O4WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q70gKKNBDTT6oZYNdG8Lt7un4f4ZclFiRRcw2qe8Ylw=; b=gbbJS8GUx6tFw9pPryQYN/m27oXrrxya8bovymPXLwjxrhNeLM5aZ+ft+BxlHv90Io FRSdfnP0+gSEd7zqcY31YL1Op7cVGiMAyjGlel8ty9Pr0ax/xKx8UEKZosrzkeJrqGqO 9fBQ4LenA9KAVkBzfg3lVr0ePBs8eUHNPidt8aCx1DsGBYYg7sK+FCJ0i+HTjd/5jxnQ Zliza4b3W1k219IpDVmFHqdWdKLIMK546Q75Wzjety4wzxwHgkS8+gkuWBfI63z3LjFC jgkXSwkN3vYk5QimlEZcuzFJYSEkHRfSM0YOa2qFDQ8rTIsrCMum7F0zPBiQYU/i6xNG hrjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gLpGbeEF; 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 r7si10896953ple.281.2019.02.11.06.25.43; Mon, 11 Feb 2019 06:25:59 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gLpGbeEF; 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 S1728399AbfBKOUx (ORCPT + 99 others); Mon, 11 Feb 2019 09:20:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:53620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbfBKOUv (ORCPT ); Mon, 11 Feb 2019 09:20:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E8B8A2073F; Mon, 11 Feb 2019 14:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894851; bh=xI62sbsWMUW17iABDBaWgqegJfZfBz9LMeDbkmHHxGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gLpGbeEFn2CXQITlP5h0xNSUnndi9BzrXqwFDPsp0zLMSrgMoi5YlpCQJbt6hDMDH h14cMaqqTbBZCYp4Y4VapM9DgrFl/KMet00ff8fedg12mR04ii35DyWP2u5fNSRJs7 lh1zLbDu4PL1gWSlrT7K5ltsf4CSCGQVjgHdDIAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.20 010/352] ath10k: fixup extended per sta tx statistics Date: Mon, 11 Feb 2019 15:13:57 +0100 Message-Id: <20190211141847.088980946@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 539b44e70c5b4ad82d2c0c97a4dfb37523d891f6 ] I had a couple concerns with this code. First, we definitely need to set the error code if the kzalloc() fails. Secondly, I was worried that if we didn't set "arsta->tx_stats" to NULL after freeing it, then it looks to me like it might lead to a use after free. I can't test that, but it's harmless to set it to NULL so I did. Fixes: a904417fc876 ("ath10k: add extended per sta tx statistics support") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/mac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7e49342bae38..b4764fee4751 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6296,8 +6296,10 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, if (ath10k_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; + } } num_tdls_stations = ath10k_mac_tdls_vif_stations_count(hw, vif); @@ -6385,8 +6387,10 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, "mac vdev %d peer delete %pM sta %pK (sta gone)\n", arvif->vdev_id, sta->addr, sta); - if (ath10k_debug_is_extd_tx_stats_enabled(ar)) + if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { kfree(arsta->tx_stats); + arsta->tx_stats = NULL; + } if (sta->tdls) { ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, -- 2.19.1