From nobody Sat Jul 25 18:07:54 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06A693164D8 for ; Wed, 15 Jul 2026 06:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784097662; cv=none; b=fqeeSl351OIO6dIV8C9F88oUYGA454UnW+3Bq3Q9uHBqpdqPB0TRUE79ZOCQpPYveyc7MD+udwM1gGBOPcKR+bHwNpZXsX9BQjDUmYXmGl5EhmAiX2yuzuWtJn3ZlUmBQ2GYNHkKJca50T6k5BjCBN9v7OJF2LF64WgWP4amxXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784097662; c=relaxed/simple; bh=h5BFxK93+aSnNy14rKckWgOePbkl/k1HqzJ+gAWCAEk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GrJGqti3rZCrVUUOYRtmLrxgDWVwidCg1NgqP+/k7p8TqTsPa+NkdSLwb9BDF7jZn8lizujbIABWM7ZFSFsmLbHnGd46NVkTTn6zryyhloCQpSHH/YUXVxKKdECYuEcFkVZaaMWrCXUFy1ywxd32NMVEiALJ3tIJ+DKFdcgws28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c7vEaGNW; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c7vEaGNW" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-3811f512167so5785487a91.3 for ; Tue, 14 Jul 2026 23:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784097660; x=1784702460; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=oeq61mqCq1QhzXC9+NpA6dqzmbivhALns06QC0nTUSk=; b=c7vEaGNWFLChVcnbwEJ6muypj/W2ehTIfueMqw6eGq3dsfXSkBFprnmsz2F9SLD5ch Vdn0RmsoBjLAq/kDuwtKYesBCfozxMVw5WtWlkHXfpiI1yrgnm15rPsdp+PNg4WTQKha DVdBnvjwPobZlwEgyM9+jmQxb483mLpNevPqDj2FHYEF0SMTsO30jA9F4PxjrgFmGdzJ Par7f8I9TC6dgcCSQ5NYXz2JMBelBh7AKkXzMrGSv/ZKUykACdreX8BOJs37sSEESFuF Z44FPj4wmLS5evNrXZeDkJYTcwMI2IbLAqOKq0gmvmHEm0FzO8q7hJpxZfiSS8Hygraj ovjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784097660; x=1784702460; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oeq61mqCq1QhzXC9+NpA6dqzmbivhALns06QC0nTUSk=; b=M0+2NIqy6l/ICLLciHVsRUohBJ4ZePgJEZvZMb81+MtAMR8WuV9jYdJSEtMbSDu2x4 L15teTj7PKT0iy5Ig0nq5IuOR/jSKwXEZSfyY1qBZdgJxw6u37guwchp4HeO3YLW+gpp WxrEqhe6Vzfk6twBjRZI+K//+y/X3a5nZ1ELC4uSwYi8FhdzT9lsQCfoTOPVWxX9ALVh Q52FBUJ5TLH2AUMef2R6X9p4ZGQ75ZpdZVAc8G0vYJ1jU5EETTryCN3+eXfpzq96TEJv eUOKmf9cSEF0n/cvQlfF9lJUo1piGG1P+dCypdKLl138PH8ovO7CJRHanaDpANbj3isQ k1sg== X-Forwarded-Encrypted: i=1; AHgh+Rol4NgDdwuosByQGaDPHTFqOvJR0fMIjQWZCrmAGzohJISD5xZIOqj40lfUp2aCEa/2da+uMTQLZlWko4M=@vger.kernel.org X-Gm-Message-State: AOJu0YwY/NQu20y2lIyDFbarNpkejkzrHwCSwEjHhmyyrWUnEOx+HmWa PCLOP96l93kqQ8V1Ar2Av+XvYnxjL6gz+xz/epeymbAEmJnuKlIsLH/D X-Gm-Gg: AfdE7ckPw3dgI1kHCe9v/qgTLXfRPryl0kKQD66gn7vNv35pS/MVtzvNGMtAZwrlTBr i0enNB6PVACm1WT+JVEbUhCURI9jZUCeHjZFaj8NwpVkLYaZiOnLwS/pfIYFRr+UNOWF3mtBEsZ scxEoex3isvcTpmFqoN6ahg+NhWAcq+dulpAdEYkrtj2XbYxvfK7J4hR0H6UAe6swsjb1g/HiQ0 PS0OvnDxkcmRBUR7p5Qt+hx4Xn8qJMhVMzsX01drDY+fayO748Ub0547GVPfS3espLyt0B2hGaR eoFycRSIvIIz+4CWKTu4rgC3700QGVvNCuvZo9SHf2KXmcfCL8bjedi08v6O4NhCFEe4DnE9yJx nV7JGj1HzPkH0uVIh30+H9FdwaqqhhBV2hZ9OvAtCCaB3DUpUcdI8uhMmpNMfhrRQToXqqpDa3i kyMhGyhkPVWw== X-Received: by 2002:a05:6a21:329d:b0:3bf:77d7:667d with SMTP id adf61e73a8af0-3c3573b6069mr5927585637.28.1784097660214; Tue, 14 Jul 2026 23:41:00 -0700 (PDT) Received: from lgs.. ([101.76.249.46]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ca79aff904dsm9138269a12.6.2026.07.14.23.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 23:40:59 -0700 (PDT) From: Guangshuo Li To: Jeff Johnson , Anilkumar Kolli , Sriram R , Shashidhar Lakkavalli , Kalle Valo , Venkateswara Naralasetty , Vasanthakumar Thiagarajan , Baochen Qiang , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, ath12k@lists.infradead.org Cc: Guangshuo Li Subject: [PATCH v2] wifi: ath11k/ath12k: release QMI handles on late init failures Date: Wed, 15 Jul 2026 14:40:42 +0800 Message-ID: <20260715064042.1988288-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k and ath12k initialize their QMI handles before allocating the QMI event workqueues and registering the service lookups. If either of these later initialization steps fails, the functions return without releasing the initialized QMI handles, leaking their resources. Release the QMI handles on the late failure paths in both drivers. ath12k_qmi_deinit_service() uses ab->qmi.ab to determine whether QMI service initialization completed successfully. Set it only after all initialization steps succeed. Keep the ath11k assignment unchanged because ath11k does not use it as an initialization-success guard. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Fixes: 088a099690e4 ("wifi: ath12k: fix error handling in creating hardware= group") Signed-off-by: Guangshuo Li --- v2: - Set ath12k ab->qmi.ab only after QMI service initialization succeeds, as suggested by Baochen Qiang. - Fix the same late initialization QMI handle leak in ath11k, as suggested by Vasanthakumar Thiagarajan. - Drop the Reviewed-by tag due to the code changes. drivers/net/wireless/ath/ath11k/qmi.c | 10 ++++++++-- drivers/net/wireless/ath/ath12k/qmi.c | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/a= th/ath11k/qmi.c index 410a7ee076a0..6e3f82169d24 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -3329,7 +3329,8 @@ int ath11k_qmi_init_service(struct ath11k_base *ab) ab->qmi.event_wq =3D alloc_ordered_workqueue("ath11k_qmi_driver_event", 0= ); if (!ab->qmi.event_wq) { ath11k_err(ab, "failed to allocate workqueue\n"); - return -EFAULT; + ret =3D -EFAULT; + goto err_release_qmi_handle; } =20 INIT_LIST_HEAD(&ab->qmi.event_list); @@ -3342,9 +3343,14 @@ int ath11k_qmi_init_service(struct ath11k_base *ab) if (ret < 0) { ath11k_warn(ab, "failed to add qmi lookup: %d\n", ret); destroy_workqueue(ab->qmi.event_wq); - return ret; + goto err_release_qmi_handle; } =20 + return ret; + +err_release_qmi_handle: + qmi_handle_release(&ab->qmi.handle); + return ret; } =20 diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/a= th/ath12k/qmi.c index fd762b5d7bb5..692f1b2c2031 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -4041,7 +4041,6 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) =20 memset(&ab->qmi.target, 0, sizeof(struct target_info)); memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); - ab->qmi.ab =3D ab; =20 ab->qmi.target_mem_mode =3D ab->target_mem_mode; ret =3D qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX, @@ -4054,7 +4053,8 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) ab->qmi.event_wq =3D alloc_ordered_workqueue("ath12k_qmi_driver_event", 0= ); if (!ab->qmi.event_wq) { ath12k_err(ab, "failed to allocate workqueue\n"); - return -EFAULT; + ret =3D -EFAULT; + goto err_release_qmi_handle; } =20 INIT_LIST_HEAD(&ab->qmi.event_list); @@ -4067,9 +4067,16 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) if (ret < 0) { ath12k_warn(ab, "failed to add qmi lookup\n"); destroy_workqueue(ab->qmi.event_wq); - return ret; + goto err_release_qmi_handle; } =20 + ab->qmi.ab =3D ab; + + return ret; + +err_release_qmi_handle: + qmi_handle_release(&ab->qmi.handle); + return ret; } =20 --=20 2.43.0