Re: [PATCH v2] misc: microchip: pci1xxxx: fix IRQ vector leak in gp_aux_bus_probe()
From: Guangshuo Li
Date: Thu Apr 16 2026 - 06:15:44 EST
Hi,
On Mon, 13 Apr 2026 at 22:40, Guangshuo Li <lgs201920130244@xxxxxxxxx> wrote:
>
> gp_aux_bus_probe() allocates IRQ vectors with pci_alloc_irq_vectors()
> before initializing and adding the second auxiliary device.
>
> When pci_irq_vector(), auxiliary_device_init() or auxiliary_device_add()
> for the second auxiliary device fails, the function unwinds the auxiliary
> devices and ida allocations, but leaves the allocated IRQ vectors behind.
>
> The issue was identified by a static analysis tool I developed and
> confirmed by manual review. Add a dedicated error path to call
> pci_free_irq_vectors() after IRQ vectors have been allocated
> successfully.
>
> Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
> ---
> v2:
> - note that the issue was identified by my static analysis tool
> - and confirmed by manual review
>
> drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c
> index 34c9be437432..5e1f99a35100 100644
> --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c
> +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c
> @@ -93,14 +93,14 @@ static int gp_aux_bus_probe(struct pci_dev *pdev, const struct pci_device_id *id
>
> retval = pci_irq_vector(pdev, 0);
> if (retval < 0)
> - goto err_aux_dev_init_1;
> + goto err_irq_vectors;
>
> pdev->irq = retval;
> aux_bus->aux_device_wrapper[1]->gp_aux_data.irq_num = pdev->irq;
>
> retval = auxiliary_device_init(&aux_bus->aux_device_wrapper[1]->aux_dev);
> if (retval < 0)
> - goto err_aux_dev_init_1;
> + goto err_irq_vectors;
>
> retval = auxiliary_device_add(&aux_bus->aux_device_wrapper[1]->aux_dev);
> if (retval)
> @@ -113,6 +113,9 @@ static int gp_aux_bus_probe(struct pci_dev *pdev, const struct pci_device_id *id
>
> err_aux_dev_add_1:
> auxiliary_device_uninit(&aux_bus->aux_device_wrapper[1]->aux_dev);
> +
> +err_irq_vectors:
> + pci_free_irq_vectors(pdev);
> goto err_aux_dev_add_0;
>
> err_aux_dev_init_1:
> --
> 2.43.0
>
I re-checked this issue on our side and found that my previous
analysis was incorrect. This patch is therefore not needed.
I'll drop this patch.
Sorry for the noise, and thanks.
Guangshuo