From: Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>
To: Corey Minyard <corey@minyard.net>
Cc: openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Eric Yun Lin Chiang <ericyunlinchiang@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] ipmi: ipmb_dev_int: initialise event handler read bytes
Date: Thu, 3 Dec 2026 14:34:40 +0800 [thread overview]
Message-ID: <20261203063440.3753378-1-ericyunlinchiang@gmail.com> (raw)
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
reply other threads:[~2026-12-03 6:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261203063440.3753378-1-ericyunlinchiang@gmail.com \
--to=ericyunlinchiang@gmail.com \
--cc=corey@minyard.net \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=stable@vger.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®