All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baochen Qiang <quic_bqiang@quicinc.com>
To: <ath11k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH v10 03/12] wifi: ath11k: fix a possible dead lock caused by ab->base_lock
Date: Mon, 18 Dec 2023 16:58:35 +0800	[thread overview]
Message-ID: <20231218085844.2658-4-quic_bqiang@quicinc.com> (raw)
In-Reply-To: <20231218085844.2658-1-quic_bqiang@quicinc.com>

spin_lock/spin_unlock are used in ath11k_reg_chan_list_event to
acquire/release ab->base_lock. For now this is safe because that
function is only called in soft IRQ context.

But ath11k_reg_chan_list_event() will be called from process
context in an upcoming patch, and this can result in a deadlock if
ab->base_lock is acquired in process context and then soft IRQ occurs
on the same CPU and tries to acquire that lock.

Fix it by using spin_lock_bh and spin_unlock_bh instead.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23

Fixes: 69a0fcf8a9f2 ("ath11k: Avoid reg rules update during firmware recovery")
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
v10:
 no change.
v9:
 no change.
v8:
 no change.
v7:
 no change.

 drivers/net/wireless/ath/ath11k/wmi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index a48aafc79b90..9f8a62c334b0 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -7142,13 +7142,13 @@ int ath11k_reg_handle_chan_list(struct ath11k_base *ab,
 	/* Avoid default reg rule updates sent during FW recovery if
 	 * it is already available
 	 */
-	spin_lock(&ab->base_lock);
+	spin_lock_bh(&ab->base_lock);
 	if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags) &&
 	    ab->default_regd[pdev_idx]) {
-		spin_unlock(&ab->base_lock);
+		spin_unlock_bh(&ab->base_lock);
 		goto retfail;
 	}
-	spin_unlock(&ab->base_lock);
+	spin_unlock_bh(&ab->base_lock);
 
 	if (pdev_idx >= ab->num_radios) {
 		/* Process the event for phy0 only if single_pdev_only
@@ -7201,7 +7201,7 @@ int ath11k_reg_handle_chan_list(struct ath11k_base *ab,
 		ab->reg_info_store[pdev_idx] = *reg_info;
 	}
 
-	spin_lock(&ab->base_lock);
+	spin_lock_bh(&ab->base_lock);
 	if (ab->default_regd[pdev_idx]) {
 		/* The initial rules from FW after WMI Init is to build
 		 * the default regd. From then on, any rules updated for
@@ -7221,7 +7221,7 @@ int ath11k_reg_handle_chan_list(struct ath11k_base *ab,
 		ab->default_regd[pdev_idx] = regd;
 	}
 	ab->dfs_region = reg_info->dfs_region;
-	spin_unlock(&ab->base_lock);
+	spin_unlock_bh(&ab->base_lock);
 
 	return 0;
 
-- 
2.25.1


  parent reply	other threads:[~2023-12-18  8:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  8:58 [PATCH v10 00/12] wifi: ath11k: add support for 6 GHz station for various modes : LPI, SP and VLP Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 01/12] wifi: ath11k: add support to select 6 GHz regulatory type Baochen Qiang
2024-01-14 14:59   ` Kalle Valo
2023-12-18  8:58 ` [PATCH v10 02/12] wifi: ath11k: store cur_regulatory_info for each radio Baochen Qiang
2023-12-18  8:58 ` Baochen Qiang [this message]
2023-12-18  8:58 ` [PATCH v10 04/12] wifi: ath11k: update regulatory rules when interface added Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 05/12] wifi: ath11k: update regulatory rules when connect to AP on 6 GHz band for station Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 06/12] wifi: ath11k: save power spectral density(PSD) of regulatory rule Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 07/12] wifi: ath11k: add parse of transmit power envelope element Baochen Qiang
2024-01-11 17:13   ` Jeff Johnson
2024-01-12  6:25     ` Kalle Valo
2023-12-18  8:58 ` [PATCH v10 08/12] wifi: ath11k: save max tx power in vdev start response event from firmware Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 09/12] wifi: ath11k: fill parameters for vdev set tpc power WMI command Baochen Qiang
2023-12-18 21:13   ` Jeff Johnson
2023-12-19  6:30     ` Kalle Valo
2023-12-18  8:58 ` [PATCH v10 10/12] wifi: ath11k: add WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT service bit Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 11/12] wifi: ath11k: add handler for WMI_VDEV_SET_TPC_POWER_CMDID Baochen Qiang
2023-12-18  8:58 ` [PATCH v10 12/12] wifi: ath11k: use WMI_VDEV_SET_TPC_POWER_CMDID when EXT_TPC_REG_SUPPORT for 6 GHz Baochen Qiang
2024-01-11 16:08 ` [PATCH v10 00/12] wifi: ath11k: add support for 6 GHz station for various modes : LPI, SP and VLP Kalle Valo
2024-01-11 16:49   ` Jeff Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231218085844.2658-4-quic_bqiang@quicinc.com \
    --to=quic_bqiang@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.