From: "tip-bot2 for Pengpeng Hou" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Pengpeng Hou <hppiscas@163.com>,
Thomas Gleixner <tglx@kernel.org>,
Anup Patel <anup@brainfault.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: irq/drivers] irqchip/riscv-imsic: Reject overlapping group index fields
Date: Thu, 15 Oct 2026 09:54:45 -0000 [thread overview]
Message-ID: <179205808597.2666988.2381906930105082201.tip-bot2@tip-bot2> (raw)
In-Reply-To: <caplitmus-rv.v2.imsic.f2c0e5bdc627451c83deb0cf7eb8834a@163.com>
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 8caa8fcec8db5358437b9b7ca456bc3093d2a4d0
Gitweb: https://git.kernel.org/tip/8caa8fcec8db5358437b9b7ca456bc3093d2a4d0
Author: Pengpeng Hou <hppiscas@163.com>
AuthorDate: Sun, 20 Sep 2026 21:07:54 +08:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Thu, 15 Oct 2026 11:50:48 +02:00
irqchip/riscv-imsic: Reject overlapping group index fields
The IMSIC address layout places the group index above the page offset,
guest index and HART index. imsic_parse_fwnode() checks the individual
field widths and the upper end of the group field, but does not check
that its lower end is above the other fields.
Reject a nonzero group field whose shift overlaps the lower fields.
Otherwise a firmware-supplied layout can assign the same address bit to
different indices when MSI target addresses are constructed.
Keep the existing upper-bound check unchanged. The new lower-bound
check applies only when group index bits are present.
The issue was found by our static-analysis tool.
Fixes: 21a8f8a0eb35 ("irqchip: Add RISC-V incoming MSI controller early driver")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: gpt 5
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://patch.msgid.link/caplitmus-rv.v2.imsic.f2c0e5bdc627451c83deb0cf7eb8834a@163.com
---
drivers/irqchip/irq-riscv-imsic-state.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index 9505ddb..960c71d 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -740,6 +740,14 @@ static int __init imsic_parse_fwnode(struct fwnode_handle *fwnode,
return -EINVAL;
}
+ /* Group index bits must not overlap guest and HART index bits. */
+ i = IMSIC_MMIO_PAGE_SHIFT + global->guest_index_bits +
+ global->hart_index_bits;
+ if (global->group_index_bits && global->group_index_shift < i) {
+ pr_err("%pfwP: group index shift too small\n", fwnode);
+ return -EINVAL;
+ }
+
/* Sanity check group index shift */
i = global->group_index_bits + global->group_index_shift - 1;
if (i >= BITS_PER_LONG) {
next prev parent reply other threads:[~2026-10-15 9:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 13:07 [PATCH v2] " Pengpeng Hou
2026-09-23 11:12 ` Anup Patel
2026-10-14 8:59 ` Pengpeng Hou
2026-10-15 9:54 ` tip-bot2 for Pengpeng Hou [this message]
2026-11-01 22:16 ` patchwork-bot+linux-riscv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179205808597.2666988.2381906930105082201.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=anup@brainfault.org \
--cc=hppiscas@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®