[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcZ6-WFyyERg7YVXNj3-uggwyNf2fF4mnbhiUZ6xNwYvg@mail.gmail.com>
Date: Mon, 16 Jun 2025 14:09:39 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Marek Vasut <marek.vasut@...lbox.org>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>,
Marek Vasut <marek.vasut+bmc150@...lbox.org>, Hans de Goede <hansg@...nel.org>,
linux-iio@...r.kernel.org, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, David Lechner <dlechner@...libre.com>,
Jonathan Cameron <jic23@...nel.org>, Julien Stephan <jstephan@...libre.com>,
Peter Zijlstra <peterz@...radead.org>, Salvatore Bonaccorso <carnil@...ian.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: accel: bmc150: Do not configure IRQ registers if no
IRQ connected
On Mon, Jun 16, 2025 at 2:03 PM Marek Vasut <marek.vasut@...lbox.org> wrote:
> On 6/16/25 10:47 AM, Andy Shevchenko wrote:
> > On Fri, Jun 13, 2025 at 07:02:28PM +0200, Marek Vasut wrote:
> >> On 6/13/25 5:09 PM, Andy Shevchenko wrote:
> >>> 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 */
> >>>> }
> >
> >>>> }
...
> >>> As for the solution, are you sure the line is not wired at all?
> >>
> >> No . It is some cheap mini-laptop , I have no schematics or any other info
> >> really .
> >
> >> Note that I am not really familiar with x86 and ACPI, so there is that.
> >
> > Yes, I understand that.
> >
> > You can try to monitor the /sys/kernel/debug/pinctrl/*/pins files for any
> > changes that might happen on the sensor events. It might (help to) reveal
> > the IRQ line.
> Sooo ... if the IRQ line is not described in ACPI, it could still be
> connected ? Hum, I'll try to shake the laptop next time I power it up.
Yes, it's possible, unfortunately due to the closed / per-product
nature of the Windows drivers.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists