From patchwork Thu Sep 20 05:04:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10606865 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 11C316CB for ; Thu, 20 Sep 2018 05:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 013AE2B9D0 for ; Thu, 20 Sep 2018 05:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9B612BAD5; Thu, 20 Sep 2018 05:04:59 +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,RCVD_IN_DNSWL_NONE 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 9353B2B9D0 for ; Thu, 20 Sep 2018 05:04:59 +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: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=4WAjKDdsC0Qg8FWfZRtgxgfVpIODNChiazExHLNyVpg=; b=jlmInGDldZ6m8H mnsipWP10XUkfSdyZ/gm0ViaqrakuzRl93MmDbWQNuxfDRFGb87y032V2fx5tCoi8xXmn9qjV1j1y xZfYwyPA9jw8lF0E+CWmZ3IocO7hwnYtgy/a5bz5nkh+DJqRjnGVid92ehqxL31hXA4liXgbJs/v0 vRafXOPjniLznaIP4gyMTCbiXg5EsgGs3NWw+VRmSH8k+zxPog24UEEpLwkju9+iezZVQbIABS/St tumuguHeBSJ7Q9mFYns2E6cY6Atw6+/cQiJThun/neFpuK71JWnDK/b/BbhMLlRPF4Mo2M7/f5bTC /1FlVlw481MImm9b70gg==; 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 1g2r93-0007Lv-V3; Thu, 20 Sep 2018 05:04:53 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2r8v-0007Is-0d for ath10k@lists.infradead.org; Thu, 20 Sep 2018 05:04:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F343A605FD; Thu, 20 Sep 2018 05:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537419874; bh=N1bgpLhIh+f1cwhutS9lEDF4oxuQ7BwF0uIpvXXHVkQ=; h=From:To:Cc:Subject:Date:From; b=VPV1CyptR7/DtF3FYIGYb4mLq77OoRUcVrm1OG5Phb+OgONEFy4X7kGFdUPzuqW05 HI63zrcR6gciELP/yySfKcmw3JDcMAB8jsc4nSY3v1QKCCfp0NEeBYKb58/pBOSYAZ jiXqB3Bs1nCGpMUzFoOUqZFgM5qMgOeK6JfFOg3I= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4C12C60214; Thu, 20 Sep 2018 05:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537419873; bh=N1bgpLhIh+f1cwhutS9lEDF4oxuQ7BwF0uIpvXXHVkQ=; h=From:To:Cc:Subject:Date:From; b=GdaFwUniNatLPk1yfk0nmXYuubpYOtTpm87Wy5YwiZwZbfiULsKBG3kQIeDscMO87 6M6gt65AlGiy2RlIF+HNYD0a351kSPTSmL9PpjAH34VC6sS7SjrUDjpKc7PBO2Gg6y x8MuGy3krrwjj0dvyVBSdSAyF7vKQ28F7oSGHSJ4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4C12C60214 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org Subject: [PATCH 1/2] ath10k: Move napi_enable to hif_start for consistent pairing Date: Thu, 20 Sep 2018 10:34:25 +0530 Message-Id: <20180920050426.4113-1-govinds@codeaurora.org> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180919_220445_106233_6B899A8B X-CRM114-Status: GOOD ( 11.59 ) 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: Govind Singh , 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 There is unbalanced napi_{enable,disable}() behavior as they are being called from hif_snoc_{power_up/stop). The fix is to call napi_enable() from ath10k_snoc_hif_start() so that it matches with napi_disable() being called from ath10k_snoc_hif_stop(). Signed-off-by: Govind Singh --- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index ed52a6308f76..dd043b858c8e 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -919,6 +919,7 @@ static void ath10k_snoc_hif_stop(struct ath10k *ar) static int ath10k_snoc_hif_start(struct ath10k *ar) { + napi_enable(&ar->napi); ath10k_snoc_irq_enable(ar); ath10k_snoc_rx_post(ar); @@ -1017,7 +1018,6 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar) goto err_wlan_enable; } - napi_enable(&ar->napi); return 0; err_wlan_enable: From patchwork Thu Sep 20 05:04:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10606863 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 5BDD95A4 for ; Thu, 20 Sep 2018 05:04:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4970D2B9D0 for ; Thu, 20 Sep 2018 05:04:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D7292C1E3; Thu, 20 Sep 2018 05:04:54 +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,RCVD_IN_DNSWL_NONE 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 EFD052B9D0 for ; Thu, 20 Sep 2018 05:04:53 +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:References:In-Reply-To: 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: List-Owner; bh=vmxEIb7BjoC8RreSwbevbGumPN3in1yefs6FYzUt/r4=; b=EsnxuvkX5w26wq IVGyxplG/rG2FYP7/ogKm2sA+o0cZ+eYM5F3gaH/f5dl62yGn0Ot7R+6KMpGjvJfj1llv1JVtXy2B wJUqqJRzVbasy/BjAkh2ZSTO311Uc3eT6itCNrNWoAP5oIG8aHo+4uvPA7kn5RtQMGBCY1dslQOBH LIX+Et9uGTcXSYmmQ7dJofHdLL+oes8Ot8rCmADLh4g9QZ/ygf2BjAb10R77eK5Gesm2DRLUjzwJv frIqMoeXygiKtMkcKuEd3xPUJ3PuKek2rl+ONIIIsb7CjRAweQAeXIbZfOpHl+iUOZ2DmvLTbLw16 2vJCNhRMOb+Bp3dceMwQ==; 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 1g2r8z-0007Kf-Vt; Thu, 20 Sep 2018 05:04:49 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2r8v-0007J2-1G for ath10k@lists.infradead.org; Thu, 20 Sep 2018 05:04:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4411960C4B; Thu, 20 Sep 2018 05:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537419877; bh=GcidKvFMpTnl001YYjxOHhjYO3wM04hHe0pDftwrzMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwe8eBIu8qJdy+bpfXTLbn4U7TMsyK61+BF3qbdtUqtHqkJZ5RjHqtUkgje/iO5a5 zkM8c0vJpqOg6bRP2a8Mc8SKu9qZWbo0N1VD1q5ROzqWO5SqfMe0aNPczldurP/I89 Wx6ztF3ozPkWeciavK/AWKDptS0M0A6EVmZOGJA4= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A8201607F7; Thu, 20 Sep 2018 05:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537419877; bh=GcidKvFMpTnl001YYjxOHhjYO3wM04hHe0pDftwrzMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwe8eBIu8qJdy+bpfXTLbn4U7TMsyK61+BF3qbdtUqtHqkJZ5RjHqtUkgje/iO5a5 zkM8c0vJpqOg6bRP2a8Mc8SKu9qZWbo0N1VD1q5ROzqWO5SqfMe0aNPczldurP/I89 Wx6ztF3ozPkWeciavK/AWKDptS0M0A6EVmZOGJA4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A8201607F7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: Disable napi before resource cleanup to avoid "use after free" Date: Thu, 20 Sep 2018 10:34:26 +0530 Message-Id: <20180920050426.4113-2-govinds@codeaurora.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180920050426.4113-1-govinds@codeaurora.org> References: <20180920050426.4113-1-govinds@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180919_220445_140871_F5924A25 X-CRM114-Status: GOOD ( 10.90 ) 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: Govind Singh , 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 CE buffers are cleaned up prior to napi disable and this is causing NULL pointer dereference due to "use after free". Disable napi before resource cleanup to avoid "use after free". Signed-off-by: Govind Singh --- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index dd043b858c8e..6da951eea345 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -911,9 +911,9 @@ static void ath10k_snoc_buffer_cleanup(struct ath10k *ar) static void ath10k_snoc_hif_stop(struct ath10k *ar) { ath10k_snoc_irq_disable(ar); - ath10k_snoc_buffer_cleanup(ar); napi_synchronize(&ar->napi); napi_disable(&ar->napi); + ath10k_snoc_buffer_cleanup(ar); ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); }