Chrome platform driver development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Chad Aldreda <ca@modelmiser.com>
Cc: "Dan Callaghan" <dcallagh@chromium.org>,
	"Benson Leung" <bleung@chromium.org>,
	"Sami Kyöstilä" <skyostil@chromium.org>,
	chrome-platform@lists.linux.dev, stable@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] platform/chrome: cros_hps_i2c: fix use-after-free in release() after unbind
Date: Fri, 13 Nov 2026 06:12:37 +0000	[thread overview]
Message-ID: <avaqVeJWzupa__xr@google.com> (raw)
In-Reply-To: <20261110123230.1251547-2-ca@modelmiser.com>

On Tue, Nov 10, 2026 at 12:32:40PM +0000, Chad Aldreda wrote:
>  static int hps_release(struct inode *inode, struct file *file)
>  {
> -	struct hps_drvdata *hps = container_of(file->private_data,
> -					       struct hps_drvdata, misc_device);
> -	struct device *dev = &hps->client->dev;
> +	struct hps_drvdata *hps = file->private_data;
>  
> -	pm_runtime_put(dev);
> +	mutex_lock(&hps->lock);
> +	if (!hps->removed) {
> +		hps->open_count--;
> +		pm_runtime_put(&hps->client->dev);

I realized we can use `hps->client` directly to tell whether the device has
detached (i.e., set `hps->client` to NULL in hps_i2c_remove()).

Could you respin the patch to use `hps->client` instead of the `removed`
flag?

      reply	other threads:[~2026-11-13  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 12:32 [PATCH v2] platform/chrome: cros_hps_i2c: fix use-after-free in release() after unbind Chad Aldreda
2026-11-13  6:12 ` Tzung-Bi Shih [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=avaqVeJWzupa__xr@google.com \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=ca@modelmiser.com \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dcallagh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skyostil@chromium.org \
    --cc=stable@vger.kernel.org \
    /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