Re: [PATCH 0/7] iio: validate SPI match data before use

From: Jonathan Cameron

Date: Fri Sep 25 2026 - 21:11:56 EST


On Fri, 25 Sep 2026 21:17:29 +0800
Jiale Yao <yaojiale02@xxxxxxx> wrote:

> SPI driver_override can bind a device without a matching entry in the
> driver's ID tables. spi_get_device_match_data() then returns NULL.
>
> These seven IIO drivers use that result without checking it, causing a
> NULL pointer dereference during probe. Add the missing checks before
> the match data is used.

I was hoping we'd close this finally by adding a flag to the
drivers to say they should fail a match if driver_override is set.
Given I thought maybe that would happen when Andy looked into this
a while back I've been sitting on this problem for a while.


Unfortunately seems we have to carry on papering over it in the
drivers for now :(

Ah well. Series is fine, so applied and marked for stable.
I'm not going to rush these in though so they can wait for the
next merge window.

Thanks

Jonathan


>
> Jiale Yao (7):
> iio: amplifiers: ad8366: reject devices without match data
> iio: dac: ad5755: validate SPI match data
> iio: dac: mcp4821: reject devices without match data
> iio: frequency: adf4377: reject devices without match data
> iio: imu: adis16400: validate SPI match data
> iio: potentiometer: x9250: reject devices without match data
> iio: pressure: bmp280: validate SPI match data
>
> drivers/iio/amplifiers/ad8366.c | 2 ++
> drivers/iio/dac/ad5755.c | 3 +++
> drivers/iio/dac/mcp4821.c | 7 +++++--
> drivers/iio/frequency/adf4377.c | 3 +++
> drivers/iio/imu/adis16400.c | 3 +++
> drivers/iio/potentiometer/x9250.c | 7 ++++++-
> drivers/iio/pressure/bmp280-spi.c | 2 ++
> 7 files changed, 24 insertions(+), 3 deletions(-)
>