Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp53808ybg; Mon, 8 Jun 2020 16:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZV5gwxICVT8cvIB6nf7AiVPR2k+wZZYBKEhfDwVt64hDmgu8r05f6ueiozoT1S4YdzZV9 X-Received: by 2002:a50:f694:: with SMTP id d20mr23330405edn.171.1591658054829; Mon, 08 Jun 2020 16:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658054; cv=none; d=google.com; s=arc-20160816; b=F2SEdKL/zKdDlIllupq4lSvIJHCiBfOpSBqcB2JxrjvV8Y5vSCDdbPgiups0hO5l9g E0LhXTZkURJN/2S7J7x1gp3xQF25sjOix9Pdwh+/cKj9eShscRilSYnUAeNHiJ1TTKk5 e90pwhi3i2HBp5v5vX2LlWF09KTSUZyEIErNmkanq8IlRdNtYKj5rXxfl5U4GLKy3fS4 /dWh9VU7Yl2eHPs1dU4XyZopiHN0oMuczHpwOyP2yW/S3rA62Z+gfUew1sBwK/ohfh85 djRQ8gai0dTacYVM2jPHxCMO6Pu1bNWZHFdVXspnrkJqXTdrtsjg1qG6Rgls7wLIqEUp ylXQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ppVChNn+zIehRId5iMKHdK8ujae8kimG6cNU00ZouZQ=; b=Ho/VlnH3A6XsNOhccYT5s/XiUqFa9NSpSKXICQobxaO4nrl/ej6SiD+402EyG3VAl9 8zd/xuHk3ycbocxR2lbpz3M/7AygFKiGeVLx9lv/cbQllqKGEEXCEzhHf7omVySZ5NMw ulPCvdgxf9SrHNHtVxn8iYRJCfqx26OaSeMkRA7u9CmDlAl8H9a2TFi55g0Ay9QfXQ/e 3h+jPKTT+f5kWRB4pAQde7JSABRj5DOzmy87SAcEH7ny3j5Krji4RRi+illBxIZZn/Im 0zFFmcfRYVXuwh8QsJ2e7l4Thwd8/nJ+Mf/2EKbrTv/5T92hX3UaH4VNy+F8AbGArvXq zcXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NImMvxuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh21si9639375ejb.54.2020.06.08.16.13.52; Mon, 08 Jun 2020 16:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NImMvxuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728372AbgFHXJN (ORCPT + 99 others); Mon, 8 Jun 2020 19:09:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728107AbgFHXIL (ORCPT ); Mon, 8 Jun 2020 19:08:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3832B20842; Mon, 8 Jun 2020 23:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657691; bh=UgH8czb3Zqf99cuf6/cq5xSM1xd308oDJ5vXdkILL9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NImMvxuqEixileN0cKasTp1aFKdtMLCwg1iIfjFyF9fv37jbF6iU7Ct6dEOMmIxa7 LLgNlo/97uYHUknNhQvR+Di4AMmidwrMVeXXL/99neosQJYELI35TL23LxOfpeiRwS 8NbV7BOq/QM++pzixWzH2Y1W+cGAvdILbkhsrDc8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Venkateswara Naralasetty , Kalle Valo , Sasha Levin , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 092/274] ath10k: fix kernel null pointer dereference Date: Mon, 8 Jun 2020 19:03:05 -0400 Message-Id: <20200608230607.3361041-92-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Venkateswara Naralasetty [ Upstream commit acb31476adc9ff271140cdd4d3c707ff0c97f5a4 ] Currently sta airtime is updated without any lock in case of host based airtime calculation. Which may result in accessing the invalid sta pointer in case of continuous station connect/disconnect. This patch fix the kernel null pointer dereference by updating the station airtime with proper RCU lock in case of host based airtime calculation. Proceeding with the analysis of "ARM Kernel Panic". The APSS crash happened due to OOPS on CPU 0. Crash Signature : Unable to handle kernel NULL pointer dereference at virtual address 00000300 During the crash, PC points to "ieee80211_sta_register_airtime+0x1c/0x448 [mac80211]" LR points to "ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]". The Backtrace obtained is as follows: [] (ieee80211_sta_register_airtime [mac80211]) from [] (ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]) [] (ath10k_txrx_tx_unref [ath10k_core]) from [] (ath10k_htt_txrx_compl_task+0xa50/0xfc0 [ath10k_core]) [] (ath10k_htt_txrx_compl_task [ath10k_core]) from [] (ath10k_pci_napi_poll+0x50/0xf8 [ath10k_pci]) [] (ath10k_pci_napi_poll [ath10k_pci]) from [] (net_rx_action+0xac/0x160) [] (net_rx_action) from [] (__do_softirq+0x104/0x294) [] (__do_softirq) from [] (run_ksoftirqd+0x30/0x90) [] (run_ksoftirqd) from [] (smpboot_thread_fn+0x25c/0x274) [] (smpboot_thread_fn) from [] (kthread+0xd8/0xec) Tested HW: QCA9888 Tested FW: 10.4-3.10-00047 Signed-off-by: Venkateswara Naralasetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1585736290-17661-1-git-send-email-vnaralas@codeaurora.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/txrx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index 39abf8b12903..f46b9083bbf1 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -84,9 +84,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); + rcu_read_lock(); if (txq && txq->sta && skb_cb->airtime_est) ieee80211_sta_register_airtime(txq->sta, txq->tid, skb_cb->airtime_est, 0); + rcu_read_unlock(); if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL) dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); -- 2.25.1