* [PATCH] ipmi: ipmb_dev_int: initialise event handler read bytes
@ 2026-12-03 6:34 Eric Yun Lin Chiang
0 siblings, 0 replies; only message in thread
From: Eric Yun Lin Chiang @ 2026-12-03 6:34 UTC (permalink / raw)
To: Corey Minyard
Cc: openipmi-developer, linux-kernel, Eric Yun Lin Chiang, stable
IPMB does not use i2c reads, but ipmb_slave_cb() still has to set *val
on I2C_SLAVE_READ_REQUESTED and I2C_SLAVE_READ_PROCESSED. It leaves it
untouched, so a master that reads from the slave address gets whatever
the bus driver had there. On aspeed the first byte is the address byte
that was just received and every following byte is an uninitialised
stack variable.
Return 0xff, as ipmi_ipmb does since commit 9f235ccecd03 ("ipmi: ipmb:
initialise event handler read bytes").
Fixes: 51bd6f291583 ("Add support for IPMB driver")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>
---
Notes (not for the changelog):
- Testing: a KUnit case on UML with KASAN, kept out of this patch and
available on request, calls ipmb_slave_cb() for both read events with
*val preset to 0xa5: before, it stays 0xa5; after, 0xff. A write of
two bytes is stored the same way before and after. Built for ARM
(aspeed_g5_defconfig plus IPMB_DEVICE_INTERFACE) with W=1, no new
warnings. Not run on hardware.
- Tool use: found, and this change and its test drafted, with the help
of an AI coding assistant (Claude).
drivers/char/ipmi/ipmb_dev_int.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
index 5edc2be85..4ccc75321 100644
--- a/drivers/char/ipmi/ipmb_dev_int.c
+++ b/drivers/char/ipmi/ipmb_dev_int.c
@@ -292,6 +292,12 @@ static int ipmb_slave_cb(struct i2c_client *client,
ipmb_handle_request(ipmb_dev);
break;
+ case I2C_SLAVE_READ_REQUESTED:
+ case I2C_SLAVE_READ_PROCESSED:
+ /* IPMB does not use reads, but the bus driver sends *val */
+ *val = 0xff;
+ break;
+
default:
break;
}
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-03 6:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 6:34 [PATCH] ipmi: ipmb_dev_int: initialise event handler read bytes Eric Yun Lin Chiang
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®