All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] firmware: arm_scmi: imx: Track copied syslog words
@ 2026-10-28 13:05 Sudeep Holla
  2026-10-28 13:05 ` [PATCH 2/3] firmware: arm_scmi: imx: Validate MISC control response size Sudeep Holla
  2026-10-28 13:49 ` [PATCH 1/3] firmware: arm_scmi: imx: Track copied syslog words Peng Fan
  0 siblings, 2 replies; 8+ messages in thread
From: Sudeep Holla @ 2026-10-28 13:05 UTC (permalink / raw)
  To: linux-arm-kernel, arm-scmi
  Cc: Sudeep Holla, Cristian Marussi, Peng Fan, Sashiko

The MISC syslog iterator records the number of returned words plus
firmware-reported remaining words in the caller's size output.

The debugfs consumer uses that value to dump its fixed-size buffer. A
malformed or inconsistent response can therefore make it read beyond
the copied data and allocation.

Return the accumulated number of words copied into the caller's buffer
instead. The generic iterator bounds this count to the initial buffer
capacity before processing each response.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-c3c9437c-ba1a-4db6-837f-cb0950d89018
Fixes: 4fa62e80c7db ("firmware: arm_scmi: imx: Support getting syslog of MISC protocol")
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
 drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
index 637973fb45e6..0c708b2dd496 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
@@ -438,7 +438,7 @@ static int iter_misc_syslog_update_state(struct scmi_iterator_state *st,
 
 	st->num_returned = RETURNED(r->numlogflags);
 	st->num_remaining = REMAINING(r->numlogflags);
-	*p->size = st->num_returned + st->num_remaining;
+	*p->size = st->desc_index + st->num_returned;
 
 	return 0;
 }
-- 
2.43.0



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

end of thread, other threads:[~2026-10-29 22:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 13:05 [PATCH 1/3] firmware: arm_scmi: imx: Track copied syslog words Sudeep Holla
2026-10-28 13:05 ` [PATCH 2/3] firmware: arm_scmi: imx: Validate MISC control response size Sudeep Holla
2026-10-28 13:05   ` [PATCH 3/3] firmware: arm_scmi: Unregister notifier on enable failure Sudeep Holla
2026-10-28 13:51     ` Peng Fan
2026-10-28 13:49   ` [PATCH 2/3] firmware: arm_scmi: imx: Validate MISC control response size Peng Fan
2026-10-29 22:05   ` Philip Radford
2026-10-28 13:49 ` [PATCH 1/3] firmware: arm_scmi: imx: Track copied syslog words Peng Fan
2026-10-28 13:55   ` Sudeep Holla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.