The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: jikos@kernel.org, srinivas.pandruvada@linux.intel.com,
	bentiss@kernel.org, linux-input@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/2] HID: sensor: custom: Fix fields lifetime issues
Date: Sun, 12 Jul 2026 00:59:06 +0100	[thread overview]
Message-ID: <20260712005906.4f196ff9@jic23-huawei> (raw)
In-Reply-To: <20260707071545.3087073-1-haoxiang_li2024@163.com>

On Tue,  7 Jul 2026 15:15:43 +0800
Haoxiang Li <haoxiang_li2024@163.com> wrote:

> Hi,
> 
> This series fixes lifetime issues around sensor_inst->fields and the
> sysfs attributes that can access it.
> 
> The first patch creates the field attributes before exposing enable_sensor
> and removes enable_sensor before freeing the field attributes. This keeps
> enable_sensor from accessing power_state and report_state pointers after
> the fields array has been freed.
> 
> The second patch fixes the original field sysfs group leak on probe
> failure by unwinding any field groups that were created before a later
> sysfs_create_group() failure.
Series applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> 
> Changes in v3:
>  - Move the enable_sensor registration reorder from patch 2 to patch 1.
>  - Add a comment explaining why enable_sensor is removed before fields.
>  - Add Reported-by and Link tags for the Sashiko review.
>  - Keep patch 2 focused on the field sysfs group cleanup. Tanks, Jonathan!
> 
> Changes in v2:
>  - Split the fix into two patches.
>  - Unwind already-created field sysfs groups on failure. Thanks, Jiri!
> 
> Haoxiang Li (2):
>   HID: sensor: custom: Fix use-after-free in enable_sensor
>   HID: sensor: custom: Fix field sysfs group cleanup on failure
> 
>  drivers/hid/hid-sensor-custom.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> 
> base-commit: ef0c9f75a19532d7675384708fc8621e10850104


      parent reply	other threads:[~2026-07-11 23:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  7:15 [PATCH v3 0/2] HID: sensor: custom: Fix fields lifetime issues Haoxiang Li
2026-07-07  7:15 ` [PATCH v3 1/2] HID: sensor: custom: Fix use-after-free in enable_sensor Haoxiang Li
2026-07-08 17:58   ` srinivas pandruvada
2026-07-07  7:15 ` [PATCH v3 2/2] HID: sensor: custom: Fix field sysfs group cleanup on failure Haoxiang Li
2026-07-08 17:58   ` srinivas pandruvada
2026-07-11 23:59 ` 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=20260712005906.4f196ff9@jic23-huawei \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=bentiss@kernel.org \
    --cc=haoxiang_li2024@163.com \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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