Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2363955lqp; Sun, 24 Mar 2024 15:56:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdXR+T/7dzdPW1lN8KlOC1ye71neAhHTQkhthU8GNtk4VMocbkhOgOo2lDWVShq4Fxy0ax/C1FlKD4VtGgfBnaVkOmLugSnESTg+naCg== X-Google-Smtp-Source: AGHT+IHOWNDLzklOI5mSypQ0A7ngD3i4hoRB3aJ3LoVxFU9a0Qq6E/QEeof6udYOpxMAo4sMIXs7 X-Received: by 2002:a05:6a00:938d:b0:6e6:46f2:d4c8 with SMTP id ka13-20020a056a00938d00b006e646f2d4c8mr5938567pfb.23.1711320997844; Sun, 24 Mar 2024 15:56:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711320997; cv=pass; d=google.com; s=arc-20160816; b=OG8TtQXb1WqTEYEtwUCUFOXy+JK0djz6hQwgnrY4IurTy4Q4MPxxpP0gcPzNbcOfny p2SNMEnOMI3JVqrNsxKGwn/PE/W4qu+N5xmUG4fVsFRcQmAc7GOXMbMk5wNOK8uHypA4 DaSwMNQxbNGq7otdgZ728uu4tn20Ky89ft7iQnW3LkKyQzrynWCZ/uM8cWC4EBD2LBPI ZiIyus7tr3vnRSc1zOt1/NCvLSkTfJ6rHB9NRvSHmyd4h4M2XlN8QM8eLF+WClVSEjFT KxEeqp/j4p+6n+/eM4WapCcqrJDtpqEUz2GbCg7zYGUYOolbaw2BI/YWZzEkpVQV1O1a VoXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/5ayqaPm8Sh3CYLYlIlp9lw7RikT2BKHj+2pBhOngQk=; fh=4Z8LvTHAZC04L6h7UAlIT/rKH1ShJkjncbjwTpCLSAE=; b=EwQD29Aji2xnGACfq32pvTW7D/PG/7oNBWZ7OAGcCpafkJYFIdEC9eenxhsSiAJAk3 ZFlNckuVzT+dOorp+zp2wV8sQCPc0ANz0EZE/gaB6QITYYyni3GqjqutmXj+H9jygCtw ogfqZNsssm8GxxvWYYkSScMkhhZGQKoGUpniAOR60Ra3wnWR5DLIwFgC+T5551BhPLUL z0sLSHNNyZheDu1OeZf6cVBiqfr36RMdPTmrVe7fAxv28R39ZfboIzWzIgMyr44Voofo X92cU0A4M/fuuzp0NJd45C79Hs9Xo3WGGjqWEgow9xnNHa4b8wkEBYFqR1mVynKgx6Wn PRhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i00GsFaP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id g16-20020aa79f10000000b006e735f90cbasi3987143pfr.240.2024.03.24.15.56.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 15:56:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i00GsFaP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 10B09B2099C for ; Sun, 24 Mar 2024 22:50:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D46B839F8; Sun, 24 Mar 2024 22:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i00GsFaP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 308B483A0F; Sun, 24 Mar 2024 22:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319764; cv=none; b=gB4yDe3YQTR7jkZKXmM+ef2YwoGY/EQTXjQ7UKUGpS26X7MFaahaxDm1exmdSJK++TSEpJ74iw9O/c0YW0hyTKOlxNVMjAEHdnM03grYd08hQb3jarb0EpfZuOjr3FA3701eUk4bs3kZwRh44PCDiJmLc4X6+il5kKn7LJ/ZVI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319764; c=relaxed/simple; bh=MOxlhC3dPM+XBhOSTUcc9poorlCAcDLGIwRC0xTng1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PkZZvbHYORv1S+bDUUFpjx2Ap2mPBHQiysQAm8S4TYBv/w4Z8DvD0mVWy8Uu5QlAATu38VP7iQzEbHW+aOjKPpIzAmoNfg4q2KXJ/Ung4KZG+CK+ZY69jW7l8SEYnGkIL3KZMl2lNjGg/i6F3okb0lN/4EHGEDxkARDbPnUMuos= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i00GsFaP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6427C43394; Sun, 24 Mar 2024 22:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319763; bh=MOxlhC3dPM+XBhOSTUcc9poorlCAcDLGIwRC0xTng1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i00GsFaPDH+Mr6og8hryEDAjSsSB3vCdP6vHS6ygEsRRwYArUepz9hyjJMvQD0h41 bokrWFI3XIC6SuAtBN47l2TKNE2E/VdKm5uxn4N83hrXy1tdNlIACRdT2D0rxMJcf/ F+Si1o+vLioOs9b3zeQMZYMyhulc3KTY4/hCeIzRtYdPWOJHWq3w4ViylUzBoLIvIB EtSa8J5mwSBsjkuFS8JVTmvLBuWEbah3FCFwS08Om6HkDqYhXIj0VNCMK6DvjgXyBu c1zxnwIL9x1xNh2bJwrQNwCTL7lO/Oa3z9N0corvjFs9GS/yYT44juq6yT8WS+7jPM enHoEHzQMt+lA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Baochen Qiang , Wen Gong , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 6.8 064/715] wifi: ath11k: fix a possible dead lock caused by ab->base_lock Date: Sun, 24 Mar 2024 18:24:03 -0400 Message-ID: <20240324223455.1342824-65-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Baochen Qiang [ Upstream commit cf2df0080bd59cb97a1519ddefaf59788febdaa5 ] 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 Signed-off-by: Wen Gong Acked-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://msgid.link/20231218085844.2658-4-quic_bqiang@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/reg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c index adcd9063a59c3..d4fd3509e608c 100644 --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c @@ -852,13 +852,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 @@ -911,7 +911,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 @@ -931,7 +931,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.43.0