Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp349078pxu; Fri, 11 Dec 2020 03:59:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQ3oPN8nBznPUHz2g7WplwmfBcJVxTnu50wi2tfimato6AbHoXQitR9RJyWta/QTcTcqJ6 X-Received: by 2002:a17:906:c248:: with SMTP id bl8mr10508396ejb.343.1607687987341; Fri, 11 Dec 2020 03:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607687987; cv=none; d=google.com; s=arc-20160816; b=PgotoUutgWI+uNzoDFu0ukVZfEOiWcKWTR8QX9EUqU+xoqRn9VkQgJc+SWCXE5LB02 cShnU5FBU4VUSU16H5lumB5meaXZBDL8la3q+vwQ3ZmzaoLjgi54TcX1YWx2ph3i+Fma eh3zsn4+rZSTNY7o9Ia1pC15ixwY4fyGo9cgZiUPAhOfGKh7Kxts0vwgFUkNh1zOTKF2 MKjr6EHfc3PSnkVVOeammFOfwMruiZq3i6gEkRGw9drH3tbFPuKSHUM/+PjC7txWKikQ GdYuY0jz6NI6++m9GCqNOk5IxppXK878PNINAd89gE8Pm/B2EW9KroAn0wOb8eiVVxIj YKsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=llJHorwskmXWrjfo+IOAoxI0Bh3S9VvxGycnIGs2tVg=; b=B4nc1Ne0/58ifhnd0NHCpxXj70ffbx6TQrgSnD9RWIiowz9dtTHQ2HzZ3BjHvx3KHp ub+aIqHLuRuVb9ZeUpB12obFRRaJR6GfUJRojvBWf/HEIdfOOq3grtqji3HjKyIeDMN3 VPRv+7xa4rDXPpdhU/hYR0mXQsixxOrC8+Q5nqJZUPAQeu8iw0Pdfs5TQwydweWpGy7d lrAYTPu+QtZkHAZTO9stkd9pf2Ztz83tyZibfSXM+c/ggy24SBSdWGZRkpAccX15djfG ZutUcCAY03h3p1201r7wbDv499TFAwQZrCrfWJuRiqQJRrLjmAhJvsQCiDLuEy/L26sd 3azA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=IHNULY3Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt24si4423161ejb.248.2020.12.11.03.59.23; Fri, 11 Dec 2020 03:59:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=@mg.codeaurora.org header.s=smtp header.b=IHNULY3Y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395328AbgLKF5h (ORCPT + 99 others); Fri, 11 Dec 2020 00:57:37 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:42304 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395322AbgLKF5X (ORCPT ); Fri, 11 Dec 2020 00:57:23 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1607666218; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=llJHorwskmXWrjfo+IOAoxI0Bh3S9VvxGycnIGs2tVg=; b=IHNULY3YCR7FXwhsagPsfuhj8bydzysTCVkdK/Sp3wKBAq3AL7FgYwLxu31clncX0mYtx+is /6IMTDFR7flP0lDyUDblWFMdq6hMoimKxsIxjIkDNAvAZH2M7C8H0L6xX7HWzm4XQRBDg3f9 qbm9l1wBfRKeMnHs5Nlh/BBr/I0= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-east-1.postgun.com with SMTP id 5fd30a0535a25d1b161bc912 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 11 Dec 2020 05:56:21 GMT Sender: cjhuang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A413FC433ED; Fri, 11 Dec 2020 05:56:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from cjhuang-Inspiron-7590.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cjhuang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 772C4C433C6; Fri, 11 Dec 2020 05:56:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 772C4C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=cjhuang@codeaurora.org From: Carl Huang To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH] ath11k: fix crash caused by NULL rx_channel Date: Fri, 11 Dec 2020 00:56:13 -0500 Message-Id: <20201211055613.9310-1-cjhuang@codeaurora.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org During connect and disconnect stress test, crashed happened because ar->rx_channel is NULL. Fix it by checking whether ar->rx_channel is NULL. Crash stack is as below: RIP: 0010:ath11k_dp_rx_h_ppdu+0x110/0x230 [ath11k] [ 5028.808963] ath11k_dp_rx_wbm_err+0x14a/0x360 [ath11k] [ 5028.808970] ath11k_dp_rx_process_wbm_err+0x41c/0x520 [ath11k] [ 5028.808978] ath11k_dp_service_srng+0x25e/0x2d0 [ath11k] [ 5028.808982] ath11k_pci_ext_grp_napi_poll+0x23/0x80 [ath11k_pci] [ 5028.808986] net_rx_action+0x27e/0x400 [ 5028.808990] __do_softirq+0xfd/0x2bb [ 5028.808993] irq_exit+0xa6/0xb0 [ 5028.808995] do_IRQ+0x56/0xe0 [ 5028.808997] common_interrupt+0xf/0xf Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Carl Huang --- drivers/net/wireless/ath/ath11k/dp_rx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 2bcaf23f..17c37e2 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -2295,6 +2295,7 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc, { u8 channel_num; u32 center_freq; + struct ieee80211_channel *channel; rx_status->freq = 0; rx_status->rate_idx = 0; @@ -2315,9 +2316,12 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc, rx_status->band = NL80211_BAND_5GHZ; } else { spin_lock_bh(&ar->data_lock); - rx_status->band = ar->rx_channel->band; - channel_num = - ieee80211_frequency_to_channel(ar->rx_channel->center_freq); + channel = ar->rx_channel; + if (channel) { + rx_status->band = channel->band; + channel_num = + ieee80211_frequency_to_channel(channel->center_freq); + } spin_unlock_bh(&ar->data_lock); ath11k_dbg_dump(ar->ab, ATH11K_DBG_DATA, NULL, "rx_desc: ", rx_desc, sizeof(struct hal_rx_desc)); -- 2.7.4