From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Tomasz Figa <tfiga@chromium.org>
Cc: Benson Leung <bleung@chromium.org>,
chrome-platform@lists.linux.dev, suleiman@chromium.org
Subject: Re: [PATCH] platform/chrome: sensorhub: Fix memory overread in ring handler
Date: Thu, 2 Jul 2026 08:32:27 +0000 [thread overview]
Message-ID: <akYiGzgj79EBTmcv@google.com> (raw)
In-Reply-To: <CAAFQd5D7MqL-dK8Q12f6fsXz1tWmuXSA81XPMMqjKG==taxzOA@mail.gmail.com>
On Wed, Jul 01, 2026 at 04:20:44PM +0900, Tomasz Figa wrote:
> > diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
> > index 64e9615ed6f4..4b4adc38485c 100644
> > --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c
> > +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
> > @@ -825,11 +825,19 @@ static void cros_ec_sensorhub_ring_handler(struct cros_ec_sensorhub *sensorhub)
> > sensorhub->msg->outsize = 1;
> > sensorhub->msg->insize = fifo_info_length;
> >
> > - if (cros_ec_cmd_xfer_status(ec->ec_dev, sensorhub->msg) < 0)
> > + ret = cros_ec_cmd_xfer_status(ec->ec_dev, sensorhub->msg);
> > + if (ret < 0)
>
> I think it would be much safer to just error out if ret != fifo_info_length:
> - The data read here is used later in the code. Filling the array
> with zeroes would cause the code to act on some data that doesn't
> match the real hardware state, potentially leading to other buggy
> behaviors,
> - We silently mask bad EC behavior.
>
> We should probably also add a rate-limited print here to leave a trace
> in the logs.
Fix them in v2 [1].
[1] https://lore.kernel.org/all/20260702082745.1014968-1-tzungbi@kernel.org
prev parent reply other threads:[~2026-07-02 8:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 9:24 [PATCH] platform/chrome: sensorhub: Fix memory overread in ring handler Tzung-Bi Shih
2026-07-01 7:20 ` Tomasz Figa
2026-07-02 8:32 ` Tzung-Bi Shih [this message]
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=akYiGzgj79EBTmcv@google.com \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=suleiman@chromium.org \
--cc=tfiga@chromium.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