From patchwork Thu Jun 6 05:11:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10978429 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-2.web.codeaurora.org (Postfix) with ESMTP id 2BC601515 for ; Thu, 6 Jun 2019 05:12:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17BD11FFCD for ; Thu, 6 Jun 2019 05:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09DE9285B6; Thu, 6 Jun 2019 05:12:02 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 50AA41FFCD for ; Thu, 6 Jun 2019 05:11: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: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=fhBMjHtadwxD6YZ00e6LyNQYnMCb1IW3O3gBFSTtZAM=; b=L08 mBz/lMswEG2ra4ctWCCpnBb6v0zGQVFPxPHuF/BqsLhhnEmJ1E1YAvfmugrZ3sR6vRRFXUtZOb6Y+ ygnDFN51GL6X/BBEVuJhjpEJV20AYpAwe51lQ3Z97NA12WxgEF7zAt0amUAheL5fzuju2BNxvbZLl bRUtYWaYVXdvfdT2fnD6P4XqCeWul3dKsAnnC/rIzgWrxG+x6Mf+UwiWtFG5+2YAMOMGr3i5RF994 uPW4wzgHMT4n3bg26fxO0sCsYyTqJHbIawoEmAiLsF2DzMCLpgzhsj0TS2uJ3Mw48pg+9cAKl9XAq jsc5F9491qhZtzhq65klfqK1ABBjlHQ==; 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 1hYkgw-0000OL-Dx; Thu, 06 Jun 2019 05:11:58 +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 1hYkgt-0000Dj-TO for ath11k@lists.infradead.org; Thu, 06 Jun 2019 05:11:57 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 93C5A60388; Thu, 6 Jun 2019 05:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559797913; bh=FwfDJ1gfN4V+c6YWVefLEor0b6M/8IvcU1AM5Gn8aiE=; h=From:To:Cc:Subject:Date:From; b=LLeBgEEMoFvqExvPkiQANI4E5GZ995yvVpgr9xGqgzWHuouqxarv2Utq8lZ8NOrc5 chgEQNLLB8sWPMdzwerC/2Iy3Q43cvj+9nW+4LWHfybyZoBVnJoZiutF9gArj3zf7a /yL/lMoAKhMR0l1evWs6WuEuSnO8FOD+l5CjqC5U= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5150F60388; Thu, 6 Jun 2019 05:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1559797913; bh=FwfDJ1gfN4V+c6YWVefLEor0b6M/8IvcU1AM5Gn8aiE=; h=From:To:Cc:Subject:Date:From; b=LLeBgEEMoFvqExvPkiQANI4E5GZ995yvVpgr9xGqgzWHuouqxarv2Utq8lZ8NOrc5 chgEQNLLB8sWPMdzwerC/2Iy3Q43cvj+9nW+4LWHfybyZoBVnJoZiutF9gArj3zf7a /yL/lMoAKhMR0l1evWs6WuEuSnO8FOD+l5CjqC5U= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5150F60388 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=akolli@codeaurora.org From: Anilkumar Kolli To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: add locking on ppdu_stats_info list access Date: Thu, 6 Jun 2019 10:41:39 +0530 Message-Id: <1559797899-16925-1-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190605_221155_989957_7D85C4F4 X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasanthakumar Thiagarajan MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vasanthakumar Thiagarajan This patch fixes below issue on wifi interface with ping traffic Unable to handle kernel paging request at virtual address fffffd78 PC is at ath11k_dp_htt_htc_t2h_msg_handler+0x19c/0x728 LR is at ath11k_dp_htt_htc_t2h_msg_handler+0x28/0x728 Signed-off-by: Anilkumar Kolli Signed-off-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath11k/dp_rx.c | 29 +++++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/mac.c | 11 +++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 73865ce2b3ab..2b4c46b839b2 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1000,10 +1000,13 @@ struct htt_ppdu_stats_info *ath11k_dp_htt_get_ppdu_desc(struct ath11k *ar, { struct htt_ppdu_stats_info *ppdu_info = NULL; + spin_lock_bh(&ar->data_lock); if (!list_empty(&ar->ppdu_stats_info)) { list_for_each_entry(ppdu_info, &ar->ppdu_stats_info, list) { - if (ppdu_info && ppdu_info->ppdu_id == ppdu_id) + if (ppdu_info && ppdu_info->ppdu_id == ppdu_id) { + spin_unlock_bh(&ar->data_lock); return ppdu_info; + } } if (ar->ppdu_stat_list_depth > HTT_PPDU_DESC_MAX_DEPTH) { @@ -1015,13 +1018,16 @@ struct htt_ppdu_stats_info *ath11k_dp_htt_get_ppdu_desc(struct ath11k *ar, kfree(ppdu_info); } } + spin_unlock_bh(&ar->data_lock); ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_KERNEL); if (!ppdu_info) return NULL; + spin_lock_bh(&ar->data_lock); list_add_tail(&ppdu_info->list, &ar->ppdu_stats_info); ar->ppdu_stat_list_depth++; + spin_unlock_bh(&ar->data_lock); return ppdu_info; } @@ -1039,7 +1045,13 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab, pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_PDEV_ID_M, *(u32 *)data); pdev_id = DP_HW2SW_MACID(pdev_id); ppdu_id = *((u32 *)data + 1); - ar = ab->pdevs[pdev_id].ar; + + rcu_read_lock(); + ar = ath11k_get_ar_by_pdev_id(ab, pdev_id); + if (!ar) { + ret = -EINVAL; + goto exit; + } if (ath11k_debug_is_pktlog_lite_mode_enabled(ar)) { trace_ath11k_htt_ppdu_stats(ar, skb->data, len); @@ -1049,8 +1061,10 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab, data = (u8 *)data + 16; ppdu_info = ath11k_dp_htt_get_ppdu_desc(ar, ppdu_id); - if (!ppdu_info) - return 0; + if (!ppdu_info) { + ret = -EINVAL; + goto exit; + } ppdu_info->ppdu_id = ppdu_id; ret = ath11k_dp_htt_tlv_iter(ab, data, len, @@ -1058,10 +1072,13 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab, (void *)ppdu_info); if (ret) { ath11k_warn(ab, "Failed to parse tlv %d\n", ret); - return ret; + goto exit; } - return 0; +exit: + rcu_read_unlock(); + + return ret; } static void ath11k_htt_pktlog(struct ath11k_base *ab, diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cb0de8e2aa60..38076afbe6d1 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3342,8 +3342,6 @@ static int ath11k_start(struct ieee80211_hw *hw) goto err; } - INIT_LIST_HEAD(&ar->ppdu_stats_info); - ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_ARP_AC_OVERRIDE, 0, pdev->pdev_id); if (ret) { @@ -3392,6 +3390,7 @@ static int ath11k_start(struct ieee80211_hw *hw) static void ath11k_stop(struct ieee80211_hw *hw) { struct ath11k *ar = hw->priv; + struct htt_ppdu_stats_info *ppdu_stats, *tmp; ath11k_drain_tx(ar); @@ -3403,6 +3402,13 @@ static void ath11k_stop(struct ieee80211_hw *hw) cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); + spin_lock_bh(&ar->data_lock); + list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { + list_del(&ppdu_stats->list); + kfree(ppdu_stats); + } + spin_unlock_bh(&ar->data_lock); + rcu_assign_pointer(ar->ab->pdevs_active[ar->pdev_idx], NULL); synchronize_rcu(); @@ -5192,6 +5198,7 @@ int ath11k_mac_create(struct ath11k_base *ab) pdev->ar = ar; spin_lock_init(&ar->data_lock); INIT_LIST_HEAD(&ar->arvifs); + INIT_LIST_HEAD(&ar->ppdu_stats_info); mutex_init(&ar->conf_mutex); init_completion(&ar->vdev_setup_done); init_completion(&ar->peer_assoc_done);