mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Christopher Hoover <ch@murgatroid.com>
Cc: "Jiri Kosina" <jikos@kernel.org>,
	"Benjamin Tissoires" <bentiss@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	"Lixu Zhang" <lixu.zhang@intel.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <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 v3 0/3] iio: hid-sensors: fix shared callbacks in temperature and humidity
Date: Wed, 11 Nov 2026 02:53:36 +0000	[thread overview]
Message-ID: <20261111025336.051fbbcb@jic23-hlaptop> (raw)
In-Reply-To: <20261102215606.5e36a2a2@jic23-hlaptop>

On Mon, 2 Nov 2026 21:56:06 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sun, 18 Oct 2026 19:34:17 -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.  
> Applied to the fixes-togreg branch of iio.git with the ordering tweaks Andy suggested.

One day I'll remember some bits of this driver are in hid.

Dropped patch 1, that should go via the hid tree.

Sorry Jiri / Christopher.

I only seem to notice I've done this whilst writing pull requests :(

Jonathan



> 
> Thanks,
> 
> Jonathan
> > 
> > Changes in v3:
> > - Patches 2-3: set the callbacks with one compound literal (Jonathan).
> > - Kept Joshua's Reviewed-by on all three; patches 2-3 changed only in
> >   style.
> > - Rebased onto v7.3.
> > - Sent as a new thread, not a reply to v2.
> > 
> > Changes in v2:
> > - New patch 1, for the use-after-free on unbind found by the Sashiko
> >   review of v1.
> > 
> > v2: https://lore.kernel.org/all/20261007184423.622445-1-ch@murgatroid.com/
> > 
> > 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       | 14 +++++++-------
> >  drivers/iio/temperature/hid-sensor-temperature.c | 14 +++++++-------
> >  3 files changed, 24 insertions(+), 16 deletions(-)
> > 
> > 
> > base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222  
> 
> 


  reply	other threads:[~2026-11-11  2:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  2:34 Christopher Hoover
2026-10-19  2:34 ` [PATCH v3 1/3] HID: hid-sensor-hub: Synchronize callback removal with raw events Christopher Hoover
2026-10-22  1:21   ` Srinivas Pandruvada
2026-10-22  1:58     ` Christopher Hoover
2026-10-26 15:17       ` Pandruvada, Srinivas
2026-10-22 14:13     ` Andy Shevchenko
2026-11-02 17:19   ` srinivas pandruvada
2026-10-19  2:34 ` [PATCH v3 2/3] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Christopher Hoover
2026-10-19 10:57   ` Andy Shevchenko
2026-11-02 17:20   ` srinivas pandruvada
2026-10-19  2:34 ` [PATCH v3 3/3] iio: humidity: hid-sensor-humidity: " Christopher Hoover
2026-10-19 10:58   ` Andy Shevchenko
2026-11-02 17:21   ` srinivas pandruvada
2026-11-02  0:33 ` [PATCH v3 0/3] iio: hid-sensors: fix shared callbacks in temperature and humidity Jonathan Cameron
2026-11-02 21:56 ` Jonathan Cameron
2026-11-11  2:53   ` Jonathan Cameron [this message]
2026-11-11  3:11     ` Christopher Hoover

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=20261111025336.051fbbcb@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=bentiss@kernel.org \
    --cc=ch@murgatroid.com \
    --cc=dlechner@baylibre.com \
    --cc=jikos@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixu.zhang@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®