Jinjie Ruan (1): [Backport] genirq/msi: Fix off-by-one error in msi_domain_alloc()
kernel/irq/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Jinjie Ruan ruanjinjie@huawei.com
mainline inclusion from mainline-v6.12-rc6 commit 5f994f534120f47432092fb36f5cb0c7a80ed2bf category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBFOBV
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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: f3cf8bb0d6c3 ("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 Signed-off-by: Lin Yujun linyujun809@huawei.com --- kernel/irq/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 79b4a58ba9c3..5a4717a82024 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -702,7 +702,7 @@ static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq, ret = ops->msi_init(domain, info, virq + i, hwirq + i, arg); if (ret < 0) { if (ops->msi_free) { - for (i--; i > 0; i--) + for (i--; i >= 0; i--) ops->msi_free(domain, info, virq + i); } irq_domain_free_irqs_top(domain, virq, nr_irqs);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/14634 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/M...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/14634 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/M...