Re: [PATCH v3] irqchip/gic-v3-its: Fix double free on error

From: Markus Elfring
Date: Mon Apr 15 2024 - 09:23:54 EST


> In its_vpe_irq_domain_alloc, when its_vpe_init() returns an error
> with i > 0, its_vpe_irq_domain_free may free bitmap and vprop_page,
> and then there is a double free in its_vpe_irq_domain_alloc.
>
> Fix it by calling its_vpe_irq_domain_free directly, bitmap and
> vprop_page will be freed in this function.

I find this change description improvable.

Would you like to add the tag “Fixes” accordingly?



> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -4521,8 +4521,6 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
> struct page *vprop_page;
> int base, nr_ids, i, err = 0;
>
> - BUG_ON(!vm);


Please improve the patch granularity.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc4#n81

Regards,
Markus