All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Crofts <joshua.crofts1@gmail.com>
To: Christopher Hoover <ch@murgatroid.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	David Lechner <dlechner@baylibre.com>,
	nuno.sa@analog.com, Andy Shevchenko <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/3] iio: hid-sensors: fix shared callbacks in temperature and humidity
Date: Thu, 8 Oct 2026 09:55:57 +0200	[thread overview]
Message-ID: <20261008095557.0000617a@gmail.com> (raw)
In-Reply-To: <20261007184423.622445-1-ch@murgatroid.com>

On Wed,  7 Oct 2026 11:44:20 -0700
Christopher Hoover <ch@murgatroid.com> wrote:

> hid-sensor-temperature and hid-sensor-humidity share one static
> struct hid_sensor_hub_callbacks across instances and overwrite its pdev
> on every probe.  With two temperature sensors, reports for one go to
> the other's pdev; once that device is removed,
> temperature_capture_sample() dereferences NULL.  I hit this on 7.0
> with two uhid-created sensors.
> 
> Patches 2-3 make the callbacks per instance, as the other HID sensor
> drivers do.  Patch 1 makes sensor_hub_remove_callback() take
> pdata->lock, as sensor_hub_raw_event() does, so a report racing an
> unbind cannot call through the freed callbacks.
> 
> Changes in v2:
> - New patch 1, for the use-after-free on unbind found by the Sashiko
>   review of v1.
> 
> Christopher Hoover (3):
>   HID: hid-sensor-hub: Synchronize callback removal with raw events
>   iio: temperature: hid-sensor-temperature: Use per-instance callbacks
>   iio: humidity: hid-sensor-humidity: Use per-instance callbacks
> 
>  drivers/hid/hid-sensor-hub.c                     | 12 ++++++++++--
>  drivers/iio/humidity/hid-sensor-humidity.c       | 12 +++++-------
>  drivers/iio/temperature/hid-sensor-temperature.c | 12 +++++-------
>  3 files changed, 20 insertions(+), 16 deletions(-)
> 
> 
> base-commit: 9ee8306121495d2a25aa5d1bfd519f2748786b83

Also for future reference, please don't send a new version as a
reply to the previous version, it breaks tooling :(

-- 
Kind regards,
Joshua Crofts

      parent reply	other threads:[~2026-10-08  7:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  7:23 [PATCH 0/2] iio: hid-sensors: fix shared callbacks in temperature and humidity Christopher Hoover
2026-10-07  7:23 ` [PATCH 1/2] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Christopher Hoover
2026-10-07  7:44   ` sashiko-bot
2026-10-07  7:23 ` [PATCH 2/2] iio: humidity: hid-sensor-humidity: " Christopher Hoover
2026-10-07 18:44 ` [PATCH v2 0/3] iio: hid-sensors: fix shared callbacks in temperature and humidity Christopher Hoover
2026-10-07 18:44   ` [PATCH v2 1/3] HID: hid-sensor-hub: Synchronize callback removal with raw events Christopher Hoover
2026-10-07 18:44   ` [PATCH v2 2/3] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Christopher Hoover
2026-10-07 18:44   ` [PATCH v2 3/3] iio: humidity: hid-sensor-humidity: " Christopher Hoover
2026-10-08  7:54   ` [PATCH v2 0/3] iio: hid-sensors: fix shared callbacks in temperature and humidity Joshua Crofts
2026-10-08  7:55   ` Joshua Crofts [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=20261008095557.0000617a@gmail.com \
    --to=joshua.crofts1@gmail.com \
    --cc=andy@kernel.org \
    --cc=bentiss@kernel.org \
    --cc=ch@murgatroid.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=srinivas.pandruvada@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.