Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/alpine-msi: Fix off-by-one in allocation error path

When alpine_msix_gic_domain_alloc() fails, there is an off-by-one in the
number of interrupts to be freed.

Fix it by passing the number of successfully allocated interrupts, instead
of the relative index of the last allocated one.

Fixes: 3841245e8498 ("irqchip/alpine-msi: Fix freeing of interrupts on allocation error path")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240327142305.1048-1-yuzenghui@huawei.com

authored by

Zenghui Yu and committed by
Thomas Gleixner
ff3669a7 14ced475

+1 -1
+1 -1
drivers/irqchip/irq-alpine-msi.c
··· 165 165 return 0; 166 166 167 167 err_sgi: 168 - irq_domain_free_irqs_parent(domain, virq, i - 1); 168 + irq_domain_free_irqs_parent(domain, virq, i); 169 169 alpine_msix_free_sgi(priv, sgi, nr_irqs); 170 170 return err; 171 171 }