linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Rupert Zoone <zoone.rupert@gmail.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, "Eddie James" <eajames@linux.ibm.com>
Subject: Re: [PATCH] iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
Date: Sun, 19 Jul 2026 22:14:46 +0100	[thread overview]
Message-ID: <20260719221343.2a797351@jic23-huawei> (raw)
In-Reply-To: <CABpb+S4sg=HtYRAKOBcx+rH+1LnNbxqvfsxRuW=_kShGc4d6Og@mail.gmail.com>

On Sun, 19 Jul 2026 15:16:02 +0300
Rupert Zoone <zoone.rupert@gmail.com> wrote:

>   On Sun, Jul 19, 2026 at 12:06 PM +0300, Andy Shevchenko wrote:
>   > 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.  

For this particular driver I'd not do that as it only supports one device.
Can leave bringing a chip_info structure in until someone sends support for
a second one.

> 
>   Thanks for the review. I'd like to keep this one as the minimal fix so it
>   backports cleanly (it's Cc: stable). The chip_info/driver_data rework is a
>   good idea, but I'll do it as follow-up on top rather than fold it into the
>   stable fix.
> 
>   > 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  
> 
>   Agreed on all of these, including the devm_mutex_init() change. I'll send
>   them as a separate cleanup series once this fix and the triggered-buffer
>   patch are in, so each change stays easy to review on its own.
Excellent.  I've applied this one to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> 
>   Thanks,
>   Rupesh
> 
> On Sun, Jul 19, 2026 at 12:06 PM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> >
> > 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
> >
> >  


      reply	other threads:[~2026-07-19 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19  0:07 [PATCH] iio: pressure: dps310: fix NULL pointer dereference on ACPI probe Rupesh Majhi
2026-07-19  9:06 ` Andy Shevchenko
2026-07-19 12:16   ` Rupert Zoone
2026-07-19 21:14     ` Jonathan Cameron [this message]

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=20260719221343.2a797351@jic23-huawei \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=stable@vger.kernel.org \
    --cc=zoone.rupert@gmail.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;
as well as URLs for NNTP newsgroup(s).