Skip to content

Commit 5f994f5

Browse files
Jinjie RuanKAGA-KOKO
authored andcommitted
genirq/msi: Fix off-by-one error in msi_domain_alloc()
The error path in msi_domain_alloc(), frees the already allocated MSI interrupts in a loop, but the loop condition terminates when the index reaches zero, which fails to free the first allocated MSI interrupt at index zero. Check for >= 0 so that msi[0] is freed as well. Fixes: f3cf8bb ("genirq: Add generic msi irq domain support") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20241026063639.10711-1-ruanjinjie@huawei.com
1 parent 42f7652 commit 5f994f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/irq/msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq,
718718
ret = ops->msi_init(domain, info, virq + i, hwirq + i, arg);
719719
if (ret < 0) {
720720
if (ops->msi_free) {
721-
for (i--; i > 0; i--)
721+
for (i--; i >= 0; i--)
722722
ops->msi_free(domain, info, virq + i);
723723
}
724724
irq_domain_free_irqs_top(domain, virq, nr_irqs);

0 commit comments

Comments
 (0)