From patchwork Mon Jul 30 16:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 10549539 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 DC8C913BB for ; Mon, 30 Jul 2018 17:53:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD18E2A02C for ; Mon, 30 Jul 2018 17:53:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C13192A1D2; Mon, 30 Jul 2018 17:53:15 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 6A1AE2A02C for ; Mon, 30 Jul 2018 17:53:15 +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=zFVdbal6Fd819F3wuoTP8KJGJYFpaiAAdHe317MJAUM=; b=u0B I0ZRdqKKHKqLxq6uNlg5frOUVJUBeuhVLOKw35iZrnyivDCLSzEq3UOKQEMzc+NijbNfHWy+/BXJi Js5dx0bRJc/7jVgo2QjQj+6IJDGQFBw/Kp96C6elXiIerQN72BbyMmqVc1flzfOhrukhzpZB5jpfh ZVktKIVQjMVFazNGrvsuFkBvXAz1L+uBDIGH2aPxIlkVsbLC2pnWbMkbMQBcrjTFydmXibgTSVj7B urCg9LsI+eIcq2EDvfVPhJvf8HL5Qsda83tBAcGzuqEuQW/oX6vB+yFIb6Vw0QbHC666+wEHJl+Gn W3bZmbjA/0q3pcNHw3cjcnAzvsUoNZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkCM3-00089d-NS; Mon, 30 Jul 2018 17:53:11 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkCM2-00089S-Es for ath10k@bombadil.infradead.org; Mon, 30 Jul 2018 17:53:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Nodvg+kOWoD20v4bM7YPFiDtYI32qb1oKws029BcFgI=; b=AaKdvgPRWNTdt2+RhKM3ZH9qH 7wovcAe3V1eTH1RoDoLgQ2CaDI08xOGEpu6+twQF9sr5lVQvvtLrpn/cP7KYvx5+/0D+Cbjl4onkb UcD1+t9MDKb0VGopWiVYhLw43pnsmG1ffpw1hlQSTALAE7SYRGFk7NWXr7Ur68pO4qEI3IsixlFT6 Eoy/iZ9Wpl83VDkxetPhZggjVqOaXPmOdVNQCJAbrfq0TTxCYndw9zHgkQ0zO1fM7cdPcmfPddfuf K22c5GNPNKQ/NVExSx2NLr2Rz9PlA0THEXubv6ESe8yfM9xQMIq0lgbChXmY3g13yfCp9G+vR4WYS aCThvcEeQ==; Received: from mail2.candelatech.com ([208.74.158.173]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkBHE-0007nI-3S for ath10k@lists.infradead.org; Mon, 30 Jul 2018 16:44:09 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id EA34B40A79A; Mon, 30 Jul 2018 09:43:51 -0700 (PDT) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org, kvalo@codeaurora.org Subject: [PATCH] ath10k: Protect against buggy firmware. Date: Mon, 30 Jul 2018 09:43:49 -0700 Message-Id: <1532969029-12926-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180730_124408_228170_4F361CB0 X-CRM114-Status: UNSURE ( 6.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear While testing some buggy wave-2 firmware, I was seeing full kernel crashes. Adding this additional check keeps the kernel from crashing. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/htt_rx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 478cc67..8ab949d 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2644,9 +2644,9 @@ static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, rcu_read_lock(); spin_lock_bh(&ar->data_lock); peer = ath10k_peer_find_by_id(ar, peer_id); - if (!peer) { - ath10k_warn(ar, "Invalid peer id %d peer stats buffer\n", - peer_id); + if (!peer || !peer->sta) { + ath10k_warn(ar, "Invalid peer id %d or peer stats buffer, peer: %p sta: %p\n", + peer_id, peer, peer ? peer->sta : NULL); goto out; }