Re: [PATCH] iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
From: Andy Shevchenko
Date: Sun Jul 19 2026 - 05:06:41 EST
On Sun, Jul 19, 2026 at 03:07:52AM +0300, Rupesh Majhi wrote:
> When the device is enumerated through its ACPI HID (IFX3100),
> i2c_client_get_device_id() returns NULL: the ACPI-derived client name
> does not match the driver's i2c_device_id table. dps310_probe() then
> dereferences that NULL pointer in "iio->name = id->name" and crashes the
> kernel during probe.
>
> The IIO device name is always "dps310", so set it directly and drop the
> now-unused device-id lookup.
...
As a quick fix this patch is okay, the proper one is to go with chip_info
structure in the driver_data. where the name will be defined.
On top of that mutex_init() should be devm_mutex_init(), which is a fix,
and some cleanups:
- unused i2c_set_clientdata(); may be dropped
- C99 initialisers in ACPI ID table
- IWYU principle for the header inclusions
- some unneeded GENMASK()s due to use of sign_extend32()
- perhaps converting to use get_unaligned_xx() where it makes sense
- use time multipliers in _read_poll_timeout()
- use fsleep() and time multipliers instead of usleep_range()
- get rid of min_t(); perhaps replace with clamp() or min()
- use SI multipliers from units.h
--
With Best Regards,
Andy Shevchenko