From patchwork Fri Feb 10 11:51:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9566625 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.web.codeaurora.org (Postfix) with ESMTP id CBA79601C3 for ; Fri, 10 Feb 2017 11:52:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B74382853B for ; Fri, 10 Feb 2017 11:52:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA70228565; Fri, 10 Feb 2017 11:52:35 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3E07C2853B for ; Fri, 10 Feb 2017 11:52:35 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:To:From: Subject: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=I4DOcsecKNos760BCbHs5sk7xrXPQQzimdsfeQsx5sg=; b=k3AZpFHEu6bsqf OtpeHRVZpgSJHUfFZLEQweVDcsOdrvV5J4sm4VHE0aeZuWzo8Q1iB+xjj5Qn2Msmnx+aMsbHGMHDR a8rJEYOg1MMUefpSB0D6KT/xEhI+dlFRT1UwW3sf0CnMAQR07nv9x13V0HaffIBHiRL9k2e1WHyU2 5SsLicpaacVRWUvQHHu8nU0+MXySFrOM/M4A4Vir2W+8ySk8WTyZrxDZlyW8lxcqR52rwlR8GQXXD Dom7ClMDSYB2rbBLDznjiqYwIbfb/tog3QEiI7/STdn6RuWT7WOIsSj4FG2wE3kUt8gKdy9wHGeMw 8kx4mZylYtDYCOquE69A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cc9ka-0000lB-0n; Fri, 10 Feb 2017 11:52:28 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cc9kQ-0000SB-U5 for ath10k@lists.infradead.org; Fri, 10 Feb 2017 11:52:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1486727538; x=1518263538; h=subject:from:to:cc:date:message-id:mime-version: content-transfer-encoding; bh=FmwNyHjK3v/RwNl7Du/2jK01sNFkGKw8QhZkidwn/3Q=; b=UPSfN/LuNkKLDloeVWBMxJn/27SErKsuWh2+o3JL2eW9+0XIBmBtLXay YrWABKaXj5r8FVp/EJbGA3I7LlyoUIaB3cUwmY/7m3LrPfmCq9pbiF5zF +mGkPZnwAWNfc5gSXgCzMKksNKX+tTYQoJClryNoWl9pGuORhoTBx8Nng 8=; X-IronPort-AV: E=Sophos;i="5.35,141,1484035200"; d="scan'208";a="261783713" Received: from unknown (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by wolverine01.qualcomm.com with ESMTP; 10 Feb 2017 03:51:57 -0800 X-IronPort-AV: E=McAfee;i="5800,7501,8434"; a="1306930071" Received: from nasanexm02g.na.qualcomm.com ([10.85.0.88]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 10 Feb 2017 03:51:57 -0800 Received: from eusanexr01a.eu.qualcomm.com (10.85.0.97) by nasanexm02g.na.qualcomm.com (10.85.0.88) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 10 Feb 2017 03:51:57 -0800 Received: from potku.adurom.net (10.80.80.8) by eusanexr01a.eu.qualcomm.com (10.85.0.97) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 10 Feb 2017 03:51:54 -0800 Subject: [PATCH v4] ath10k: fix napi crash during rmmod when probe firmware fails From: Kalle Valo To: Date: Fri, 10 Feb 2017 13:51:25 +0200 Message-ID: <148672748569.28126.12259592472689214081.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01B.na.qualcomm.com (10.85.0.82) To eusanexr01a.eu.qualcomm.com (10.85.0.97) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170210_035219_142935_C41EF2AA X-CRM114-Status: UNSURE ( 8.29 ) 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: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes the below crash when ath10k probe firmware fails, NAPI polling tries to access a rx ring resource which was never allocated. An easy way to reproduce this is easy to remove all the firmware files, load ath10k modules and ath10k will crash when calling 'rmmod ath10k_pci'. The fix is to call napi_enable() from ath10k_pci_hif_start() so that it matches with napi_disable() being called from ath10k_pci_hif_stop(). Big thanks to Mohammed Shafi Shajakhan who debugged this and provided first version of the fix. In this patch I just fix the actual problem in pci.c instead of having a workaround in core.c. BUG: unable to handle kernel NULL pointer dereference at (null) IP: __ath10k_htt_rx_ring_fill_n+0x19/0x230 [ath10k_core] __ath10k_htt_rx_ring_fill_n+0x19/0x230 [ath10k_core] Call Trace: [] ath10k_htt_rx_msdu_buff_replenish+0x42/0x90 [ath10k_core] [] ath10k_htt_txrx_compl_task+0x433/0x17d0 [ath10k_core] [] ? __wake_up_common+0x4d/0x80 [] ? cpu_load_update+0xdc/0x150 [] ? ath10k_pci_read32+0xd/0x10 [ath10k_pci] [] ath10k_pci_napi_poll+0x47/0x110 [ath10k_pci] [] net_rx_action+0x20f/0x370 Reported-by: Ben Greear Fixes: 3c97f5de1f28 ("ath10k: implement NAPI support") Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 5d2f9b9922d3..6094372307aa 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1651,6 +1651,8 @@ static int ath10k_pci_hif_start(struct ath10k *ar) ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); + napi_enable(&ar->napi); + ath10k_pci_irq_enable(ar); ath10k_pci_rx_post(ar); @@ -2535,7 +2537,6 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) ath10k_err(ar, "could not wake up target CPU: %d\n", ret); goto err_ce; } - napi_enable(&ar->napi); return 0;