From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 75EB537E5C2 for ; Fri, 31 Jul 2026 23:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785539206; cv=none; b=K1zD4ZjLrTb+iC4sB0K+d5Z45JPW+BTGuXWM5dBRAJ6w0jdW2s7CPjmRKQPVJ7Dqyxc1fwJJds1r0y0ZkWDA53oCK/U8Ma0wVtMWAylMAJ4JZ9oRn7jdAg0FqQFP0Fsn+a7Ti8JwKdoOHp/+BPFHUlG96HuNXTHhpZYbb2Y/YaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785539206; c=relaxed/simple; bh=+p8w7mchGyzmIeE1JbXU5M3SPt4L2Luq0jH2toCtWl4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Dbb6rMJpTxoQ1yYS/vwveFtoX+VaKDXuX87byQh0Msfwun0Xd0ShDHJwncfALCAyEWDWZ75d/gRGyGPwMtUTPr56S4zTyf+9ca2c7Tf7OCVmCujL+dKX9cv9JH8pxGEWgz2+vz04Tvs8Eva2PlBF6qs3c1ZwBkkihJtMzFaeRWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kZKgMv1X; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=c4PwNQTX; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kZKgMv1X"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="c4PwNQTX" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VM0ZED909631 for ; Fri, 31 Jul 2026 23:06:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= U7tpd0S2YwULBAdlt+aVaG0rTF0GEY2FTOIPMSdKP60=; b=kZKgMv1XSSOQ7puU XbSnkuVRS+Ih44Nrdk/1d0zPjix3f0k5HTSa3wl8P3IDafmm8djhKlqaqWcI8Upe BNZrLQeme0UmZAqhcf6xlH3+TJkw/3alfRyJIXiIVTguYT2CnRocBmd/Mop6P/m1 gxEbW1UAUtESgNhhZ50atSytTUVR2ZBOFysbUnOrwK7inx5U5JDuUoISm11KDG14 z7zOBkeXZpMx6dR25Zs1Cw/O8RZgtm5oOUniwBFRQbfZFknocGc5bHTfrCca8o5q lJKsrDcRP1v4zfGRQMRZ6EHyX4x3xX0OxryBbOkCbqejovMbZZ5gDohupcW2nKA4 al4cRg== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4frugh2p6m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 31 Jul 2026 23:06:44 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38dbf293831so3436163a91.3 for ; Fri, 31 Jul 2026 16:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785539204; x=1786144004; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=U7tpd0S2YwULBAdlt+aVaG0rTF0GEY2FTOIPMSdKP60=; b=c4PwNQTX+ljR6vgRK9CxwA7Q7zRKraNu0bpNy3MlPTM93p1XxPgvv6dKdUVlpEL/19 1mJJZ55k6lC01kmAYnVScNU8LAPqn2Kqhfq30pza5k/gYStpIxtiw7MwUKtYnkPG9JiE pLPVRbg4IO0VcNDNfvw6E4rjqIpPlcXRcbauOEJ7FXMOXnLTtRWfLRStPak9S3E7Ir2x LobNvQfZG8+BMECv9db/0eLEiGqmDWVNiqiBh7+AdxvT8yFUasaDMfSO1iDRzb+e5y1Q QoWZFPyGfEoR+UWyb3enCKLz6hR0S4EGzfGDFFl8oDSQQdmAi9aqKSg3j8KRVRgjjO9O kAVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785539204; x=1786144004; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=U7tpd0S2YwULBAdlt+aVaG0rTF0GEY2FTOIPMSdKP60=; b=Tal3PTsCBuU5xSPOtv8HcNDCMnKH7xlxrydc2iF9yKnQb4aD77WQBkMIJMTPA20Vim 89QQXxC/PVL6Dibem+bQu421aQTgg7g3r0KJ0XdJcOWl3koZPtd8LQkcTqqqbvVrHPmg h/fxSuu0sj0KsWoYJiHcYMkXvFqr7TT5qGiO7XJFIW/Or5G453tI3qoDkmb1Ih3jxnlg uNU6KwMByHKw72rrd32MQFuCJbpselnUIDAO2w5jWtoGyoLJsOYQrCEb+vWyIra3Hoq7 AMdHIpCzkhVeL4Uw7pSll/vB1a/W2sFs7DWEgmJUK+fruro5HsLQzNMHVqpCvMyQZ+Hh 1GpA== X-Forwarded-Encrypted: i=1; AHgh+Rq1t9mmBv3RuJ/LwatLVP9HWnWyASGjwLur6wW4AQcfgXerjvDkaJ+O9+7UiZkfrxqlDW9I9wNTajLT4Uk=@vger.kernel.org X-Gm-Message-State: AOJu0YxUgXyMrPTeMLQIpbOM1UutCjhnqlfahmpcB1u9x6b3+Ul15Kv1 5oR+RYwO7dpvoZUqp0MhlrsNp1h0LEu7FuGw6WkaWBM6I+Z/Jjvom2JvBJWwot8ZgrS0oncazAE HP3ZpduSxNLC9jvxurBa7jIo73bBuR47sqMRQrbgedZvILFTha5poY7rBDP9E+nkEifI= X-Gm-Gg: AR+sD114FVIRQQYsolkrWKNK+Sl4dnxsZgZFddOy8JMeZJ5CVoYSnLSSqnDtSfLVp4W nnDSFS2XUA/0Jb48LW5giuZ2lQKBBBBM6NgH8mc0RJM1Q2EcmkVDT12g2FCBTymfvz3+f1vyIQ4 xgLaZFqftjKWy6Nvi5igN7Izt/GXjLibfmhA2nhFWTKEOW6tg+4Q+D0K1OVoyPvAsdNsaTMNTv4 fe8DKPbQ0ZfwC3CNnhrauXNZfPVABvqic6CTl9/U5MB/v5RE5fcSRJ4zBvP/vqJEkagUMOGL9uZ YD9YCof9+7KM0XaR7VbfTtKcM7orN+yIoLU5OtiVapWdyAU5eHUtlauBeHESyk7trhUh95QRqDo +62GOkGquF9MMAHCKcTxIffb6N1inxGQzr+pJ0y6JyXh4DMwaKL2pI2vStnw= X-Received: by 2002:a17:90b:1c86:b0:38d:ef48:b04 with SMTP id 98e67ed59e1d1-38fbc4249efmr1421272a91.10.1785539203823; Fri, 31 Jul 2026 16:06:43 -0700 (PDT) X-Received: by 2002:a17:90b:1c86:b0:38d:ef48:b04 with SMTP id 98e67ed59e1d1-38fbc4249efmr1421253a91.10.1785539203358; Fri, 31 Jul 2026 16:06:43 -0700 (PDT) Received: from [192.168.1.9] (103.sub-97-215-187.myvzw.com. [97.215.187.103]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fab4e44bcsm9419228c88.12.2026.07.31.16.06.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Jul 2026 16:06:42 -0700 (PDT) Message-ID: Date: Fri, 31 Jul 2026 16:06:41 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH ath-current 3/3] wifi: ath11k: unregister PM notifier on QMI init failure path To: Miaoqing Pan , jjohnson@kernel.org Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260730030948.147892-1-miaoqing.pan@oss.qualcomm.com> <20260730030948.147892-4-miaoqing.pan@oss.qualcomm.com> Content-Language: en-US From: Jeff Johnson In-Reply-To: <20260730030948.147892-4-miaoqing.pan@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDE3MyBTYWx0ZWRfX2HQ4RfM9CaeK flpzZ5nJKJNdfjIGxvIFepOtfrdisBYRDN1m88Y9xJDkMRSAaydbGMPNys/+Azor7R90/JzWWGS WWCVcVOzWpSr6z6GqY+80uyW7t508cGFpqxVjk4CVz1OB/vCWFLSdZWbJ6AMgtRdGZqH8cpksq8 PDbex3eolyneWDFbCoVtk2NLFacsRFeVMNQfN4f2J2sYmIvBM/RitcRDvIpew4Tc2+7foWz0bl0 0DMBbI+BtC5IfTPe0ltgIiHmg2DhNWev1pNPlQ/ahWHo23BtYIE5pQgNMi8xzJ7kRQXTY+vjpwd xLV+dw42BjiLtYSLuMj66FGvmEevmbdmnlq6aCYIi1ba7ZYrtICqeDek0QaoBaR2prWaK+y+wC8 t2dbIjhvTcWThzUWMLEXZxdXMULDdVs9JirWYjRx/kQAGp170bqumoVY3ZwQuYp60JYn8MeBVfF 1S9esbYgYs3Y/R9mNMQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDE3MyBTYWx0ZWRfXwvLze9TkwgDL TGKEkFGHFNNryLRS1LVqMVvoYLLw6dw88S6io3fFXs1SyW3BJGRt//Lc4pts2Xi15iLnA9INxod EYsOLWHzIZ0TWsQTBSVKX+PdhLfDrzA= X-Authority-Analysis: v=2.4 cv=U+iiy+ru c=1 sm=1 tr=0 ts=6a6d2a84 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=UaEkX0D7FlC0tWE/LoNF7Q==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=8LiCHbkhAqqawgbigPAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: zD5WzAb4LkT7t7juYwnzXqfoCca7iIxl X-Proofpoint-GUID: zD5WzAb4LkT7t7juYwnzXqfoCca7iIxl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_07,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310173 On 7/29/2026 8:09 PM, Miaoqing Pan wrote: > ath11k_core_init() registers a PM notifier before the QMI server > becomes available. If the QMI server never arrives, the device remove() > path can take the early-exit path introduced for QMI initialization > failures, skipping ath11k_core_deinit(). This patch felt wrong to me, so I spent some time with my buddy Claude. I asked Claude: in the last patch the commit text says "If the QMI server never arrives, the device remove() path can take the early-exit path introduced for QMI initialization failures". where is this device remove() path code? I'm trying to understand why there needs to be a call to ath11k_core_pm_notifier_unregister() in ath11k_ahb_remove() as well as in ath11k_core_deinit(). since ath11k_core_pm_notifier_register() is only called from one place it is logical that ath11k_core_pm_notifier_unregister() should also be called in one place that is symmetrical. the proposed patch breaks the init/deinit symmetry. Claude said: The symmetry argument is well-founded. Here's the actual structure: ath11k_core_init() registers the notifier. ath11k_core_deinit() is its symmetric counterpart and unregisters it. That is the intended 1:1 pairing. The problem is that both ath11k_ahb_remove() and ath11k_pci_remove() have an early-exit path for QMI_FAIL that bypasses ath11k_core_deinit() — but still need to undo what ath11k_core_init() did. So they replicate the unregister call directly. This is an existing pattern: pci.c:1188 already had ath11k_core_pm_notifier_unregister() in its QMI_FAIL early-exit before this patch series. Patch 3 simply extends that same pattern to ahb.c's early-exit path, which was missing it. The symmetry break isn't introduced by this patch — it was already present for PCI. The fix for the symmetry issue would be to restructure so the early-exit paths all go through ath11k_core_deinit() (or a new partial-deinit function), but that's a larger refactor. This patch's approach matches the existing convention in the tree. The commit message claim about "the early-exit path introduced for QMI initialization failures" refers to the QMI_FAIL branch at ahb.c:1301 — the goto qmi_fail block that skips ath11k_core_deinit(). Thank you, Claude. So I guess this patch is OK since it is replicating the PCI pattern, but is there any way to have ath11k_core_deinit() called in those early exit paths so that we can keep the init/deinit symmetry? It just seems wrong that if ath11k_core_init() did not return an error that we would have deinit logic that would skip calling ath11k_core_deinit() > > As a result, the PM notifier remains registered after the ath11k base > object has been freed. A subsequent suspend or resume event may invoke > the stale notifier and trigger a use-after-free. > > Fix this by explicitly unregistering the PM notifier in the QMI failure > cleanup path before releasing ath11k resources. > > Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1 > > Fixes: 32d93b51bc7e ("wifi: ath11k: choose default PM policy for hibernation") > Signed-off-by: Miaoqing Pan > --- > drivers/net/wireless/ath/ath11k/ahb.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c > index 7f5f5c8d7c56..bdb8c99f10fa 100644 > --- a/drivers/net/wireless/ath/ath11k/ahb.c > +++ b/drivers/net/wireless/ath/ath11k/ahb.c > @@ -1272,6 +1272,7 @@ static void ath11k_ahb_remove(struct platform_device *pdev) > ath11k_ahb_power_down(ab, false); > ath11k_debugfs_soc_destroy(ab); > ath11k_qmi_deinit_service(ab); > + ath11k_core_pm_notifier_unregister(ab); > goto qmi_fail; > } >