mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm_mpam: Reject ris_idx == MPAM_MSC_MAX_NUM_RIS
@ 2026-10-22  8:57 Ping Li
  2026-10-26 12:16 ` Ben Horgan
  0 siblings, 1 reply; 3+ messages in thread
From: Ping Li @ 2026-10-22  8:57 UTC (permalink / raw)
  To: james.morse, ben.horgan
  Cc: linux-kernel, linux-arm-kernel, reinette.chatre, fenghuay, Ping Li

While checking the driver's partid and ris bound checks, after the
hardware team mistakenly configured PARTID_MAX in an MSC to 16,
this issue was found: MPAM_MSC_MAX_NUM_RIS is the max number of
RIS an MSC can have, so a ris_idx of 16 passes the current check,
and would later be silently truncated to 0 by FIELD_PREP(),
landing all configuration for that ris on RIS 0.

Signed-off-by: Ping Li <leeonion.muyu@gmail.com>
---
 drivers/resctrl/mpam_devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 48adc49b833c..347a5a6d6a1d 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -700,7 +700,7 @@ static int mpam_ris_create_locked(struct mpam_msc *msc, u8 ris_idx,
 
 	lockdep_assert_held(&mpam_list_lock);
 
-	if (ris_idx > MPAM_MSC_MAX_NUM_RIS)
+	if (ris_idx >= MPAM_MSC_MAX_NUM_RIS)
 		return -EINVAL;
 
 	if (test_and_set_bit(ris_idx, &msc->ris_idxs))
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-27  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22  8:57 [PATCH] arm_mpam: Reject ris_idx == MPAM_MSC_MAX_NUM_RIS Ping Li
2026-10-26 12:16 ` Ben Horgan
2026-10-27  8:14   ` Ping Li

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®