* [PATCH ath-next 0/2] wifi: ath12k: Fix IRQ cleanup on PCI IRQ configuration failure @ 2026-08-19 6:54 Aaradhana Sahu 2026-08-19 6:54 ` [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure Aaradhana Sahu 2026-08-19 6:54 ` [PATCH ath-next 2/2] wifi: ath12k: Free allocated external " Aaradhana Sahu 0 siblings, 2 replies; 5+ messages in thread From: Aaradhana Sahu @ 2026-08-19 6:54 UTC (permalink / raw) To: ath12k Cc: linux-wireless, jjohnson, quic_kiranv, baochen.qiang, vasanthakumar.thiagarajan, Aaradhana Sahu Free partially allocated IRQ resources when PCI IRQ configuration fails. The first patch frees previously requested CE IRQs if CE IRQ configuration fails. The second patch frees previously requested external IRQs, stores the IRQ number only after request_irq() succeeds, and cleans up allocated resources on failure. Aaradhana Sahu (2): wifi: ath12k: Free allocated CE IRQs on request_irq() failure wifi: ath12k: Free allocated external IRQs on request_irq() failure drivers/net/wireless/ath/ath12k/pci.c | 55 ++++++++++++++++----------- 1 file changed, 32 insertions(+), 23 deletions(-) base-commit: e07447e654476262558bee570f4cf456e2b32565 -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure 2026-08-19 6:54 [PATCH ath-next 0/2] wifi: ath12k: Fix IRQ cleanup on PCI IRQ configuration failure Aaradhana Sahu @ 2026-08-19 6:54 ` Aaradhana Sahu 2026-08-19 10:13 ` Baochen Qiang 2026-08-19 6:54 ` [PATCH ath-next 2/2] wifi: ath12k: Free allocated external " Aaradhana Sahu 1 sibling, 1 reply; 5+ messages in thread From: Aaradhana Sahu @ 2026-08-19 6:54 UTC (permalink / raw) To: ath12k Cc: linux-wireless, jjohnson, quic_kiranv, baochen.qiang, vasanthakumar.thiagarajan, Aaradhana Sahu When CE 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 the previously requested CE IRQs before returning from the error path to ensure that partially initialized IRQ resources are properly cleaned up during probe failure. Factor out the CE IRQ cleanup into a helper to reuse the cleanup logic during both error handling and driver teardown. Also free CE IRQs when external IRQ configuration fails, before returning from the error path. 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 <aaradhana.sahu@oss.qualcomm.com> --- drivers/net/wireless/ath/ath12k/pci.c | 29 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 6441927b5382..9a78d2f69f94 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -313,6 +313,19 @@ static void ath12k_pci_sw_reset(struct ath12k_base *ab, bool power_on) ath12k_mhi_set_mhictrl_reset(ab); } +static void ath12k_pci_free_ce_irq(struct ath12k_base *ab, int num_ce) +{ + int i, irq_idx; + + for (i = 0; i < num_ce; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + + irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; + free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); + } +} + static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) { int i, j; @@ -330,15 +343,7 @@ static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) static void ath12k_pci_free_irq(struct ath12k_base *ab) { - int i, irq_idx; - - for (i = 0; i < ab->hw_params->ce_count; i++) { - if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) - continue; - irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; - free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); - } - + ath12k_pci_free_ce_irq(ab, ab->hw_params->ce_count); ath12k_pci_free_ext_irq(ab); } @@ -671,6 +676,8 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) if (ret) { ath12k_err(ab, "failed to request irq %d: %d\n", irq_idx, ret); + + ath12k_pci_free_ce_irq(ab, i); return ret; } @@ -681,8 +688,10 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) } ret = ath12k_pci_ext_irq_config(ab); - if (ret) + if (ret) { + ath12k_pci_ce_irq_disable(ab, ab->hw_params->ce_count); return ret; + } return 0; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure 2026-08-19 6:54 ` [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure Aaradhana Sahu @ 2026-08-19 10:13 ` Baochen Qiang 2026-08-19 10:20 ` Aaradhana Sahu 0 siblings, 1 reply; 5+ messages in thread From: Baochen Qiang @ 2026-08-19 10:13 UTC (permalink / raw) To: Aaradhana Sahu, ath12k Cc: linux-wireless, jjohnson, quic_kiranv, vasanthakumar.thiagarajan On 8/19/2026 2:54 PM, Aaradhana Sahu wrote: > When CE 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 the previously requested CE IRQs before returning from the error > path to ensure that partially initialized IRQ resources are properly > cleaned up during probe failure. > > Factor out the CE IRQ cleanup into a helper to reuse the cleanup logic > during both error handling and driver teardown. > > Also free CE IRQs when external IRQ configuration fails, before > returning from the error path. > > 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 <aaradhana.sahu@oss.qualcomm.com> > --- > drivers/net/wireless/ath/ath12k/pci.c | 29 ++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c > index 6441927b5382..9a78d2f69f94 100644 > --- a/drivers/net/wireless/ath/ath12k/pci.c > +++ b/drivers/net/wireless/ath/ath12k/pci.c > @@ -313,6 +313,19 @@ static void ath12k_pci_sw_reset(struct ath12k_base *ab, bool power_on) > ath12k_mhi_set_mhictrl_reset(ab); > } > > +static void ath12k_pci_free_ce_irq(struct ath12k_base *ab, int num_ce) > +{ > + int i, irq_idx; > + > + for (i = 0; i < num_ce; i++) { > + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) > + continue; > + > + irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; > + free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); > + } > +} > + > static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) > { > int i, j; > @@ -330,15 +343,7 @@ static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) > > static void ath12k_pci_free_irq(struct ath12k_base *ab) > { > - int i, irq_idx; > - > - for (i = 0; i < ab->hw_params->ce_count; i++) { > - if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) > - continue; > - irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; > - free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); > - } > - > + ath12k_pci_free_ce_irq(ab, ab->hw_params->ce_count); > ath12k_pci_free_ext_irq(ab); > } > > @@ -671,6 +676,8 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) > if (ret) { > ath12k_err(ab, "failed to request irq %d: %d\n", > irq_idx, ret); > + > + ath12k_pci_free_ce_irq(ab, i); > return ret; > } > > @@ -681,8 +688,10 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) > } > > ret = ath12k_pci_ext_irq_config(ab); > - if (ret) > + if (ret) { > + ath12k_pci_ce_irq_disable(ab, ab->hw_params->ce_count); ath12k_pci_free_ce_irq() instead ? > return ret; > + } > > return 0; > } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure 2026-08-19 10:13 ` Baochen Qiang @ 2026-08-19 10:20 ` Aaradhana Sahu 0 siblings, 0 replies; 5+ messages in thread From: Aaradhana Sahu @ 2026-08-19 10:20 UTC (permalink / raw) To: Baochen Qiang, ath12k Cc: linux-wireless, jjohnson, quic_kiranv, vasanthakumar.thiagarajan On 8/19/2026 3:43 PM, Baochen Qiang wrote: > > > On 8/19/2026 2:54 PM, Aaradhana Sahu wrote: >> When CE 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 the previously requested CE IRQs before returning from the error >> path to ensure that partially initialized IRQ resources are properly >> cleaned up during probe failure. >> >> Factor out the CE IRQ cleanup into a helper to reuse the cleanup logic >> during both error handling and driver teardown. >> >> Also free CE IRQs when external IRQ configuration fails, before >> returning from the error path. >> >> 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 <aaradhana.sahu@oss.qualcomm.com> >> --- >> drivers/net/wireless/ath/ath12k/pci.c | 29 ++++++++++++++++++--------- >> 1 file changed, 19 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c >> index 6441927b5382..9a78d2f69f94 100644 >> --- a/drivers/net/wireless/ath/ath12k/pci.c >> +++ b/drivers/net/wireless/ath/ath12k/pci.c >> @@ -313,6 +313,19 @@ static void ath12k_pci_sw_reset(struct ath12k_base *ab, bool power_on) >> ath12k_mhi_set_mhictrl_reset(ab); >> } >> >> +static void ath12k_pci_free_ce_irq(struct ath12k_base *ab, int num_ce) >> +{ >> + int i, irq_idx; >> + >> + for (i = 0; i < num_ce; i++) { >> + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) >> + continue; >> + >> + irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; >> + free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); >> + } >> +} >> + >> static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) >> { >> int i, j; >> @@ -330,15 +343,7 @@ static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) >> >> static void ath12k_pci_free_irq(struct ath12k_base *ab) >> { >> - int i, irq_idx; >> - >> - for (i = 0; i < ab->hw_params->ce_count; i++) { >> - if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) >> - continue; >> - irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + i; >> - free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); >> - } >> - >> + ath12k_pci_free_ce_irq(ab, ab->hw_params->ce_count); >> ath12k_pci_free_ext_irq(ab); >> } >> >> @@ -671,6 +676,8 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) >> if (ret) { >> ath12k_err(ab, "failed to request irq %d: %d\n", >> irq_idx, ret); >> + >> + ath12k_pci_free_ce_irq(ab, i); >> return ret; >> } >> >> @@ -681,8 +688,10 @@ static int ath12k_pci_config_irq(struct ath12k_base *ab) >> } >> >> ret = ath12k_pci_ext_irq_config(ab); >> - if (ret) >> + if (ret) { >> + ath12k_pci_ce_irq_disable(ab, ab->hw_params->ce_count); > > ath12k_pci_free_ce_irq() instead ? > My bad, I will fix this. >> return ret; >> + } >> >> return 0; >> } > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH ath-next 2/2] wifi: ath12k: Free allocated external IRQs on request_irq() failure 2026-08-19 6:54 [PATCH ath-next 0/2] wifi: ath12k: Fix IRQ cleanup on PCI IRQ configuration failure Aaradhana Sahu 2026-08-19 6:54 ` [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure Aaradhana Sahu @ 2026-08-19 6:54 ` Aaradhana Sahu 1 sibling, 0 replies; 5+ messages in thread From: Aaradhana Sahu @ 2026-08-19 6:54 UTC (permalink / raw) To: ath12k Cc: linux-wireless, jjohnson, quic_kiranv, baochen.qiang, vasanthakumar.thiagarajan, Aaradhana Sahu 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 <aaradhana.sahu@oss.qualcomm.com> --- 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 9a78d2f69f94..9bb4a6191331 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.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-19 10:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-19 6:54 [PATCH ath-next 0/2] wifi: ath12k: Fix IRQ cleanup on PCI IRQ configuration failure Aaradhana Sahu 2026-08-19 6:54 ` [PATCH ath-next 1/2] wifi: ath12k: Free allocated CE IRQs on request_irq() failure Aaradhana Sahu 2026-08-19 10:13 ` Baochen Qiang 2026-08-19 10:20 ` Aaradhana Sahu 2026-08-19 6:54 ` [PATCH ath-next 2/2] wifi: ath12k: Free allocated external " Aaradhana Sahu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox