Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795039462; b=ppoqToo4zuXUk5L98GYKDYw7jVh5XxW2flgsVt+CdzyjbR95AbPysrPahAFo31htC08c t1WGmY8avNhpOCVC+lCU7cA6HvuDTYr8ELeRigx8vwidDd0Bq8S5lj6cHn0/4eJbvHPY3 sArnhx0woxpQm79KG98MR54dlPxhf6QVRcBzOaz05QOckvxT1xX8d5n3Qk1FXwQVjPFYF YUdzrBby6f7gTECV/2bkFRlAy5TCXQEM++wvDI2oSDXnzUaYg518fpJAPOXTRrap5GpLQ T6s2RCV0HI1tdcU7SqNZ6KSborjXXW85c2PG1id/934ekkDbjsFfA9ig46o0Luywbhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795039462; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=8QJN1kmjcHRRoRG9zMhoTK21Yzn4LD/r4AKxeYl/oow=; b=ZJud7FOMSnxrSYnPCuxl4b0bfnoBB1Bop4ezHL0gUl2mwKP40cKhnNkT4qo9e1tsK3Ag VBN7K8vGzItrbXSxm2k4zWNg8W2ArWQi5GN+SbhWKb2ahat4I6GTrTornHeMOv3a9rYsZ EVmk+e/0qDwNq9uX8EwwSC//QauJphSYV+vNP0DiJ2zf/VXuqxKMeDLOna1HAe8PvT4Io SwI/wHnwljDBhAL24zGGu32qaCI7YkYDMwLIDONSCHp/gNXp7j5JWjvayCedYvvkTaW3K TJP2QKb/oebz2mWNgoItqzwwNJDcZ3rYJrnNNtgy4CNtAHF4VyrWAa8ugY+euFHy0sQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=f10f000l; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85484606A337; Wed, 18 Nov 2026 22:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=f10f000l Received: by smtp.kernel.org (Postfix) with ESMTPSA id D75531F000C4; Wed, 18 Nov 2026 22:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795039462; bh=8QJN1kmjcHRRoRG9zMhoTK21Yzn4LD/r4AKxeYl/oow=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f10f000lV1Sp/bAaPROUi2he8Ge6Pnu5V0l0dqJUcxMbIO6VFNtf0CEKuGghjgStE 5Da3CGzltoZLTeCOY9fFlYsLRWgnbDs6+ATanbR6fNe0+2L/DdG4samCw49NYT0U0M TSiBnRUl5QcYrQE1BOL2sPEr8OfehkUVIbmmUNSg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aaradhana Sahu , Rameshkumar Sundaram , Baochen Qiang , Jeff Johnson , Sasha Levin Subject: [PATCH 6.6 2110/3318] wifi: ath12k: Free allocated external IRQs on request_irq() failure Date: Wed, 18 Nov 2026 15:45:32 +0100 Message-ID: <20261118150425.371825884@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aaradhana Sahu [ Upstream commit 9a78703ec4a895bd2e99bf43bd18d76683126c19 ] When external IRQ configuration fails, the driver does not release all IRQs that were successfully requested before the failure. This can leak IRQ resources during probe failure. Free previously requested external IRQs when external IRQ configuration fails. Also remove the NAPI instance with netif_napi_del() before freeing the associated netdev to properly clean up the NAPI resources. Store the IRQ number only after request_irq() succeeds to avoid recording an IRQ that was not successfully requested. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Aaradhana Sahu Reviewed-by: Rameshkumar Sundaram Reviewed-by: Baochen Qiang Link: https://patch.msgid.link/20260819110215.2485514-3-aaradhana.sahu@oss.qualcomm.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath12k/pci.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 3121c67ee16d2..0600e83a4b0cc 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -342,11 +342,11 @@ static void ath12k_pci_free_ce_irq(struct ath12k_base *ab, int num_ce) } } -static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) +static void ath12k_pci_free_ext_irq(struct ath12k_base *ab, int num_ext_irq_grp) { int i, j; - for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + for (i = 0; i < num_ext_irq_grp; i++) { struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; for (j = 0; j < irq_grp->num_irq; j++) @@ -360,7 +360,7 @@ static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) static void ath12k_pci_free_irq(struct ath12k_base *ab) { ath12k_pci_free_ce_irq(ab, ab->hw_params->ce_count); - ath12k_pci_free_ext_irq(ab); + ath12k_pci_free_ext_irq(ab, ATH12K_EXT_IRQ_GRP_NUM_MAX); } static void ath12k_pci_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) @@ -598,8 +598,6 @@ static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) int vector = (i % num_vectors) + base_vector; int irq = ath12k_pci_get_msi_irq(ab->dev, vector); - ab->irq_num[irq_idx] = irq; - ath12k_dbg(ab, ATH12K_DBG_PCI, "irq:%d group:%d\n", irq, i); @@ -610,22 +608,24 @@ static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) if (ret) { ath12k_err(ab, "failed request irq %d: %d\n", vector, ret); - goto fail_request; + + for (n = 0; n < j; n++) + free_irq(ab->irq_num[irq_grp->irqs[n]], irq_grp); + + netif_napi_del(&ab->ext_irq_grp[i].napi); + free_netdev(ab->ext_irq_grp[i].napi_ndev); + goto fail_allocate; } + + ab->irq_num[irq_idx] = irq; } ath12k_pci_ext_grp_disable(irq_grp); } return 0; -fail_request: - /* i ->napi_ndev was properly allocated. Free it also */ - i += 1; fail_allocate: - for (n = 0; n < i; n++) { - irq_grp = &ab->ext_irq_grp[n]; - free_netdev(irq_grp->napi_ndev); - } + ath12k_pci_free_ext_irq(ab, i); return ret; } -- 2.53.0