Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Marek Vasut <marek.vasut+bmc150@mailbox.org>,
	Hans de Goede <hansg@kernel.org>
Cc: linux-iio@vger.kernel.org, "Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Julien Stephan" <jstephan@baylibre.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Salvatore Bonaccorso" <carnil@debian.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: accel: bmc150: Do not configure IRQ registers if no IRQ connected
Date: Fri, 13 Jun 2025 18:09:01 +0300	[thread overview]
Message-ID: <aEw_DcqpCpcsBGd0@smile.fi.intel.com> (raw)
In-Reply-To: <20250613124648.14141-1-marek.vasut+bmc150@mailbox.org>

Strange I don't see Hans in the Cc list, so added.
Thanks for the report and patch, my comments below.

On Fri, Jun 13, 2025 at 02:45:22PM +0200, Marek Vasut wrote:
> The BMC150 on Onemix 2S does not have IRQ line described in ACPI tables,
> which leads to bmc150_accel_core_probe() being called with irq=0, which
> leads to bmc150_accel_interrupts_setup() never being called, which leads
> to struct bmc150_accel_data *data ->interrupts[i].info being left unset
> to NULL. Later, userspace can indirectly trigger bmc150_accel_set_interrupt()
> which depends on struct bmc150_accel_data *data ->interrupts[i].info being
> non-NULL, and which triggers NULL pointer dereference. This is triggered
> e.g. from iio-sensor-proxy.
> 
> Fix this by skipping the IRQ register configuration in case there is no
> IRQ connected in hardware, in a manner similar to what the driver did in
> the very first commit which added the driver.
> 
> ACPI table dump:

>         Device (BMA2)
>         {
>             Name (_ADR, Zero)  // _ADR: Address
>             Name (_HID, "BOSC0200")  // _HID: Hardware ID
>             Name (_CID, "BOSC0200")  // _CID: Compatible ID
>             Name (_DDN, "Accelerometer")  // _DDN: DOS Device Name
>             Name (_UID, One)  // _UID: Unique ID
>             Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
>             {
>                 Name (RBUF, ResourceTemplate ()
>                 {
>                     I2cSerialBusV2 (0x0019, ControllerInitiated, 0x00061A80,
>                         AddressingMode7Bit, "\\_SB.PCI0.I2C0",
>                         0x00, ResourceConsumer, , Exclusive,
>                         )
>                 })
>                 Return (RBUF) /* \_SB_.PCI0.I2C0.BMA2._CRS.RBUF */
>             }

These lines...

>             Method (ROTM, 0, NotSerialized)
>             {
>                 Name (SBUF, Package (0x03)
>                 {
>                     "0 1 0",
>                     "1 0 0 ",
>                     "0 0 1"
>                 })
>                 Return (SBUF) /* \_SB_.PCI0.I2C0.BMA2.ROTM.SBUF */
>             }
> 
>             Method (_STA, 0, NotSerialized)  // _STA: Status
>             {
>                 Return (0x0F)
>             }

...are irrelevant.

>         }
> "
> 
> Splat, collected from debian unstable, probably not very useful:

Oh my gosh, please leave only ~3-5 *important* lines out of this, or move it
completely to the comment block (after '---' cutter line).

This is requirement written in Submitting Patches.

...

As for the solution, are you sure the line is not wired at all?
IIRC Hans had a broken tales where it was simply forgotten, meaning
the Android / Windows driver simply hardcoded needed info.

If it's the case, it should be solved differently around PDx86 special quirk
driver for the cases like this.

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2025-06-13 15:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 12:45 [PATCH] iio: accel: bmc150: Do not configure IRQ registers if no IRQ connected Marek Vasut
2025-06-13 15:03 ` David Lechner
2025-06-13 15:09   ` Andy Shevchenko
2025-06-13 15:09 ` Andy Shevchenko [this message]
2025-06-13 17:02   ` Marek Vasut
2025-06-14 13:03     ` Jonathan Cameron
2025-06-16  8:47     ` Andy Shevchenko
2025-06-16 11:03       ` Marek Vasut
2025-06-16 11:09         ` Andy Shevchenko
2025-06-21 17:33           ` Marek Vasut
2025-06-23  7:19             ` Andy Shevchenko
2025-06-16 12:42 ` Hans de Goede
2025-06-21 17:17   ` Jonathan Cameron
2025-06-21 17:24     ` Marek Vasut
2025-06-21 20:14       ` Hans de Goede
2026-01-08 21:55         ` Marek Vasut
2026-01-09  9:24           ` Linus Walleij
2026-01-09 15:00             ` Marek Vasut
2025-07-22  8:55   ` Uwe Kleine-König
2025-07-22 14:48     ` Marek Vasut
2025-07-23 15:19       ` Andy Shevchenko
2025-10-01 18:25         ` Salvatore Bonaccorso
2025-11-15 18:23           ` Jonathan Cameron
2025-07-24 13:41     ` 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=aEw_DcqpCpcsBGd0@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=carnil@debian.org \
    --cc=dlechner@baylibre.com \
    --cc=hansg@kernel.org \
    --cc=jic23@kernel.org \
    --cc=jstephan@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.vasut+bmc150@mailbox.org \
    --cc=nuno.sa@analog.com \
    --cc=peterz@infradead.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