From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 19F9838757B for ; Wed, 8 Jul 2026 10:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783505496; cv=none; b=GXfTE616ylFui4/74721ZP3I3CPInTctcAkDXVgfueD1S6wmqdoV/U+qd28cuPwCkoirmP3wkMv9lkNcYTVRY/3ngZLPXHSxIhvnRpgXpd78M1tl15L54CmUhxI+Fl+vhjaTERDr5Bx8ZTYmT4DHRiBPzrDSX70BePGPHxc289o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783505496; c=relaxed/simple; bh=71/TzMLK5ZQZwWjcBZqcnQJicIjDW4nS0phnaj6ugP4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=e5hKnrEN7lNQuENKY+FrQY89OvIDX0DX6atb2ObPeH38rOkAlrZd+vEN6MYvIw0vVkSSAHVrDvgFQXBeoBJM/RFz8sgnpBuYQGvL4Sw+hdS2avYsJW2+BTvqwrRjaq9C/UUc26kA2CjWdgvSVFeT9YlWcWfrYQND0SKaQXwrET8= 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=naKlPOx2; arc=none smtp.client-ip=209.85.216.48 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="naKlPOx2" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-381891a9525so629460a91.3 for ; Wed, 08 Jul 2026 03:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783505494; x=1784110294; 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; bh=pOJ3Pf0iHZgowhFyY91dPG9CWszSETz0W72ezmzqxqc=; b=naKlPOx2TtUsrGhq8lJnF6R9nbrKXkMyc5geuQfBbD4iOkbe6ObCEiQgROonnqrSjP FpCH1+uEGx2EmZSnnPkYDajOFWzoEHXsNuckqvT5VVFVSJVAeoFZwaHwpLeNQElPhiMk oK8Cs5YK9ELgzf2ye/nLUHLCjj8Qcicax7braElZARzbrBnsvNPxRT3G546iPhrfC6AA RPQJhtDkIvC56RZ/gf5hesEvapbG0rOMXVcL/Cy6TnF1kwJ1aU8RNjYByOQ5oRxnDSxi QPxyJBgTRyEIr+MBcXebiAMBlkccYkQT9crhEHnsEB6LLDJFTFPXsWQdlNZsVgv+Cd4T dKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783505494; x=1784110294; 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; bh=pOJ3Pf0iHZgowhFyY91dPG9CWszSETz0W72ezmzqxqc=; b=prq+LxZRHaNvuNfAXhPkwhUQINYVYmJoWewLmDTA125De6VM4dfFMvjD0RgVbCGawL 8FHwPiXhD1vz9uEckXUaFZBQz7gSaYWj9mKZ/bar4qcsINQ0lxPkmJr00oshtvFrCHd+ X1nicdWkdI7Ji2K/sKalSUAldvUZVRzhQk/IiUT/21b1ixDSLUdUOZIiSkyPiGMGtIgh fjtfTi4JWx/f9afiMXGvpLInjZ9KOMdH4fUaPRXJY/uBs01urd9Koumpi6T5L5yiwKlU IMJm8MmV/qcVxlSqg8ARyxditxxrBoQv2x3nIzleaHliBKg+RUjlEIJGSjQnbXu/homL HkyQ== X-Forwarded-Encrypted: i=1; AHgh+Rp8AYxFvBEQsIMHDyOkIMXmcw+2KWhBwrYym1UUNuxz3q3Jm3HQN/NopIlYEuUHjDdT+1MoyKCf6k32obc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw49EgqfxWhBBTw8lOQBDVCBjoVhfTMAFgYc1I42yNKTEt2Qelv 38ccghqCx9mys0YLZQ/UlJgphBVZ/hGYzrHSWV88h+1FHlFZb63/Y4k/8GWUcITHTQg= X-Gm-Gg: AfdE7ckfX03h0YKan4zZ49gWDcuEGpAOqivRy5LNxxynbzTxvfyYKSdb8TrcLu5VrXi dSFNb+FXQWMDS9GcXG1TGGU5c0Y5zwT5eUvaugE+tpq7C79pZwSaTBLelkcyBkms3tULvnJPdox keVkSNemwcmtCoaywt5vLr3o+3lhuhauGWCHK8S1lJ/fN3rMyHxB+4TOy+o96dkaQwS5PDIdT60 vqUuSAwXMByJBPm+Y4TFmxIXW3wonVBVGuvqJ9Dd/m0sq9khiuleqTLgN3GDkvFxmk8Z1Ne/FKB a2q7GLvZ5cFX6v6MAMSeuHYqNi+JUXZlHHFL5TkkGXTds1i1cN0TT6Hf33zZyX0OITRA0P0kxB9 tMa442o3GHBGgL6iuarSgi+jFiEq3u1AAIWLXl/ThRrWMMr76dfccge7obbydSUyQDr1cqgU= X-Received: by 2002:a17:90b:3c4a:b0:381:21ea:912b with SMTP id 98e67ed59e1d1-3893f693923mr1756304a91.1.1783505494416; Wed, 08 Jul 2026 03:11:34 -0700 (PDT) Received: from lgs.. ([2001:250:5800:1000::f280]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-387d17ed52bsm2438172a91.11.2026.07.08.03.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 03:11:33 -0700 (PDT) From: Guangshuo Li To: Jeff Johnson , Baochen Qiang , Vasanthakumar Thiagarajan , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH] wifi: ath12k: release QMI handle on late init failures Date: Wed, 8 Jul 2026 18:09:24 +0800 Message-ID: <20260708100924.744386-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: 8bit The change referenced by the Fixes tag makes hardware group creation skip the device whose ath12k_core_soc_create() failed, and only destroys devices that were created successfully before it. That avoids releasing an uninitialized QMI handle when qmi_handle_init() fails, but it also means that ath12k_qmi_init_service() must clean up any resources it has already acquired before returning an error. qmi_handle_init() can succeed before later initialization steps fail. If the QMI event workqueue allocation fails, or qmi_add_lookup() fails, the function returns an error without releasing the already initialized QMI handle. Since the failed device is now skipped by the hardware group rollback path, that handle is leaked. Release the QMI handle on those late failure paths and clear ab->qmi.ab so the failed device is left in the same state as the qmi_handle_init() failure path. Fixes: 088a099690e4 ("wifi: ath12k: fix error handling in creating hardware group") Signed-off-by: Guangshuo Li --- drivers/net/wireless/ath/ath12k/qmi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index fd762b5d7bb5..31e9fa9a62be 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -4054,7 +4054,8 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0); if (!ab->qmi.event_wq) { ath12k_err(ab, "failed to allocate workqueue\n"); - return -EFAULT; + ret = -EFAULT; + goto err_release_qmi_handle; } INIT_LIST_HEAD(&ab->qmi.event_list); @@ -4067,9 +4068,15 @@ 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; } + return ret; + +err_release_qmi_handle: + qmi_handle_release(&ab->qmi.handle); + ab->qmi.ab = NULL; + return ret; } -- 2.43.0