mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: accel: bmc150: clamp the device-reported FIFO frame count
Date: Sat, 13 Jun 2026 07:35:09 +0000	[thread overview]
Message-ID: <20260613073504.168858-1-hexlabsecurity@proton.me> (raw)

A couple of things that belong with the patch I just sent: the reproducer
I used, and a heads-up about an in-flight series on this file.

Reproducer
==========
I reproduced the out-of-bounds write with an in-kernel test that drives the
__bmc150_accel_fifo_flush() buffer geometry verbatim under KASAN
(CONFIG_KASAN_STACK=y), with the device-supplied frame count:

  count=127, samples=0 (flush-all), no clamp:
    BUG: KASAN: stack-out-of-bounds in ...fifo_flush
    Write of size 762 ... 'buffer'   (the 192-byte buffer)
  with the patch (clamp to BMC150_ACCEL_FIFO_LENGTH): the transfer is
    bounded to 32 samples, no KASAN report.
  a well-formed (<= 32 sample) flush is unaffected, no KASAN report.

The full 762-byte write -- a 570-byte overflow past buffer[] that smashes the
stack canary and the return address -- reproduces the same way under userspace
AddressSanitizer on -m32 and -m64. The FIFO frame count is read over I2C/SPI
from the accelerometer, so triggering this requires a malicious or defective
device, or tampering on the bus. No CVE has been assigned.

In-flight series on this file
=============================
There is an in-flight cleanup from Gabriel Rondon converting this driver's
locking to guard(mutex):

  [PATCH v3] iio: accel: bmc150: use guard(mutex) for mutex handling
  https://lore.kernel.org/all/20260525110130.61284-1-grondon@gmail.com/

That series only rewrites the mutex_lock()/mutex_unlock() pairs -- including
the bmc150_accel_fifo_flush() wrapper -- and does not touch the count handling
in __bmc150_accel_fifo_flush(), so this fix is independent of it and the two
apply cleanly together. This patch is against mainline; if the guard(mutex)
series lands first it needs only a context-line refresh.

Thanks,
Bryam


             reply	other threads:[~2026-06-13  7:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-13  7:35 Bryam Vargas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-13  7:18 Bryam Vargas via B4 Relay
2026-06-14 13:11 ` Jonathan Cameron

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=20260613073504.168858-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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®