From mboxrd@z Thu Jan 1 00:00:00 1970 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=1795015850; b=Rs5KC/zDff9WrQFIfswmAuYcX9GeQWRCHlcw4fUA3vNj4i8MQPIC2vTSN4XZ0AORuGuC ySET0J3Dmwe/HBPOpKbQ+w+lm2HA5jqKwtq52/9iOqejKEIA/OC80B3TY4xqrzryVcoSj g4GdO/3ugmkq8oza0uDkA9hkAppif4dl8GPAd2gx7EYyyUk1YvESQ+d/x3C1yI09i+lqe MLYsmO2f+LbGPGHhWYXSnNBLX1gOvyUaC77HBa/cakViXk0iJWkO8j4hQmW6wH4Zpmmvy 6QRpMjna+Yg6+i1E5FSeMAoovyhcEbdGBaeRcSnhEsFrZy9SnUZzbw+nsL9q2+OwOoA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795015850; 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=gcKVL5uefqXN3xI0u+91N5c3Fd+iG0mBFEjz3PzIkuQ=; b=Q3W4CAgcrZT78ZOOjYyEn4BRbY2pb0gMGHqgMFFIIxgJSHFg+TqqQxkcHynOdEoH20Cd REQ/C2fLNo9PUKzaRzFvxk6bnbP3SkcUM7SiRsReHvp/ME3tsfebDwjv7XefqGD88jQha RkIWUpUapWqLp5zkgRYGsTZ0RD57bUh2SjRRX/xkD3ksvcKqWQBwcyqfqUZjiekU62piH UE29EOUoduStHhTZxk3Jy3I13kOC9a/xm39gInuzQaP2emgFhvllPnaXT6chQaJ3BEAP9 bFT3t1pb1g/XyeYrNDdkB5D7N/NykAHLtVNLtKqaJYIYuqRr/4b9f51RKA6yGaK9q2Q== 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=QfMUaLtW; 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 D9FB460A2626; Wed, 18 Nov 2026 15:30:50 +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=QfMUaLtW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6215D1F000C4; Wed, 18 Nov 2026 15:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795015850; bh=gcKVL5uefqXN3xI0u+91N5c3Fd+iG0mBFEjz3PzIkuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QfMUaLtWyV1w3o4VtcBmcH2VUrFTk0L5Fn81EerGPkv/FAZOpeQTURHz2UHTL0yOR 9Z/6iZ72BuDrbm79y6dURUSOB0biuJ9edPWsQjBnZYoWQFCLr8xLHrnBJ78DtfhReA W4ZJ8Trly86rQ/PPAmK2f35m91QeRpiBFqqwCHcM= 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 7.3 0320/2651] wifi: ath12k: Free allocated external IRQs on request_irq() failure Date: Wed, 18 Nov 2026 15:26:00 +0100 Message-ID: <20261118150259.395794774@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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 4270f5d6ce4e7..12bbb75570f1f 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -326,11 +326,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++) @@ -344,7 +344,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) @@ -600,8 +600,6 @@ static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) 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); @@ -612,22 +610,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