From patchwork Thu Jan 9 04:25:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13932015 X-Patchwork-Delegate: kvalo@adurom.com Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 C97A11779AE; Thu, 9 Jan 2025 04:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736396752; cv=none; b=PT+GcGqbV/ykQIJC7V3LnXf6vve/+zGNEnTgMIfe2/Z60TBWdfkkvUrpppFJuEM66Up3pDP7W4GoQkc8n4qeGM/HmawkFcIsS6x/JkkUQMh+XrGtBJOpOF4q7Ua/3om4kkl1dRbwwv15O3Q8Izm83+KIKRNbqvO98/d8KK/THmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736396752; c=relaxed/simple; bh=gJTpP0BdlCMYLDWMVcBEJYoLCt6jUw/ruTmFIzUdX2g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PNHkngjrJVva74n+voVS8LbYaF/2eVCOoTdqFNHGX25UMVvOq8AFhl+n9mEuhf3UMCyX5nnUl/Ge6lQXUrGOnsNMTdcL2S9eik5YWT+lCYMz0Z3zKK3QEDMU47z8KNLi47c8x5jOlj3F3LKgpkawnSJrE8ETJhvX1Civrj91O30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=YPypgctk; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="YPypgctk" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 508Jt2lV018339; Thu, 9 Jan 2025 04:25:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wE5Yf90CPVn5nK08vp4XdKHzLUVd3um9BOGs3Ucg5Vs=; b=YPypgctkxiCsPNk1 wDpsN+oICtJlSwg6rpdNTgz7AZS9yueeclCh/JcrvnKJU7FscKB4quftnrahYaxr n4WOz85l+CoWVsSBXfgbTNjlsLjZG95cwtFXpzrJhkV4AHa5jikoe2BCR8vaChXo 9F5jp3befc7/20WSIX25qfioARVSfYhrJIkYpJhKMwuZX/wiW6kKYlA+r4wMkYbn QhdOYOHhPX7ThFNF+c3Wwn35KshCe0KDeQCDobxaNzgCCl9gBJhk1uaz/NWJx+hx 95lH9B9DlnRKrzmb1LxHKqz4ScunPVPn/PcvV81D7Nm/GP9OdsBadB5dwYzqG9TR SAiyjA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 441yxfgybh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jan 2025 04:25:44 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 5094PhFO010279 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 9 Jan 2025 04:25:43 GMT Received: from hu-adisi-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 8 Jan 2025 20:25:40 -0800 From: Aditya Kumar Singh Date: Thu, 9 Jan 2025 09:55:29 +0530 Subject: [PATCH 01/10] wifi: ath12k: prevent race condition in ath12k_core_hw_group_destroy() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20250109-fix_reboot_issues_with_hw_grouping-v1-1-fb39ec03451e@quicinc.com> References: <20250109-fix_reboot_issues_with_hw_grouping-v1-0-fb39ec03451e@quicinc.com> In-Reply-To: <20250109-fix_reboot_issues_with_hw_grouping-v1-0-fb39ec03451e@quicinc.com> To: Kalle Valo , Jeff Johnson , Karthikeyan Periyasamy , Harshitha Prem CC: Jeff Johnson , Kalle Valo , , , , "Aditya Kumar Singh" X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: F_0y_Vc6ds11U5_UtS3R0IdkZ_reLg57 X-Proofpoint-GUID: F_0y_Vc6ds11U5_UtS3R0IdkZ_reLg57 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 adultscore=0 mlxlogscore=779 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501090033 Currently, ath12k_core_hw_group_destroy() accesses its members without any locking mechanism. This could lead to potential issues if these members are modified by another thread concurrently. Hence to mitigate this, use the available mutex lock. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Fixes: 6f245ea0ec6c ("wifi: ath12k: introduce device group abstraction") Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 0c6b35aac96eb8d6660cbf30f807a04619feebda..514494dd56ad206a72c52492774d3387dae82f70 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -1712,6 +1712,7 @@ static void ath12k_core_hw_group_destroy(struct ath12k_hw_group *ag) if (WARN_ON(!ag)) return; + mutex_lock(&ag->mutex); for (i = 0; i < ag->num_devices; i++) { ab = ag->ab[i]; if (!ab) @@ -1719,6 +1720,7 @@ static void ath12k_core_hw_group_destroy(struct ath12k_hw_group *ag) ath12k_core_soc_destroy(ab); } + mutex_unlock(&ag->mutex); } static void ath12k_core_hw_group_cleanup(struct ath12k_hw_group *ag)