From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Benson Leung <bleung@chromium.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] platform/chrome: cros_ec_chardev: Introduce rwsem for protecting ec_dev
Date: Thu, 28 May 2026 04:33:16 +0000 [thread overview]
Message-ID: <ahfFjKooNDyOP6Zm@google.com> (raw)
In-Reply-To: <20260525052654.4076429-5-tzungbi@kernel.org>
On Mon, May 25, 2026 at 05:26:54AM +0000, Tzung-Bi Shih wrote:
> diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
> index 7e046fc56998..25ad409523b8 100644
...
> @@ -219,6 +229,10 @@ static __poll_t cros_ec_chardev_poll(struct file *filp, poll_table *wait)
> {
> struct chardev_priv *priv = filp->private_data;
>
> + guard(rwsem_read)(&priv->pdata->ec_dev_sem);
> + if (!priv->pdata->ec_dev)
> + return -ENODEV;
FWIW: I realized -ENODEV isn't a correct return value for poll().
Return EPOLLHUP instead, and squash into the patch.
next prev parent reply other threads:[~2026-05-28 4:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 5:26 [PATCH v3 0/4] platform/chrome: cros_ec_chardev: Fix a potential UAF Tzung-Bi Shih
2026-05-25 5:26 ` [PATCH v3 1/4] platform/chrome: cros_ec_chardev: Introduce chardev_data Tzung-Bi Shih
2026-05-25 5:26 ` [PATCH v3 2/4] platform/chrome: cros_ec_chardev: Move data to chardev_pdata Tzung-Bi Shih
2026-05-25 5:26 ` [PATCH v3 3/4] platform/chrome: cros_ec_chardev: Add event relayer Tzung-Bi Shih
2026-05-25 5:26 ` [PATCH v3 4/4] platform/chrome: cros_ec_chardev: Introduce rwsem for protecting ec_dev Tzung-Bi Shih
2026-05-28 4:33 ` Tzung-Bi Shih [this message]
2026-05-28 2:21 ` [PATCH v3 0/4] platform/chrome: cros_ec_chardev: Fix a potential UAF Tzung-Bi Shih
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=ahfFjKooNDyOP6Zm@google.com \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jgg@nvidia.com \
--cc=linux-kernel@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