From: Tzung-Bi Shih <tzungbi@kernel.org>
To: bleung@chromium.org
Cc: chrome-platform@lists.linux.dev, tzungbi@kernel.org,
dawidn@google.com, gregkh@linuxfoundation.org
Subject: [PATCH v2 0/6] platform/chrome: cros_ec_chardev: Fix a possible UAF
Date: Tue, 8 Jul 2025 08:00:28 +0000 [thread overview]
Message-ID: <20250708080034.3425427-1-tzungbi@kernel.org> (raw)
This is a follow-up series of [1]. It tries to fix a possible UAF in the
fops of cros_ec_chardev after the underlying protocol device has gone by
using kref in struct cros_ec_device.
The 1st patch is a cleanup.
The 2nd patch removes the dependencies of fops to struct cros_ec_dev. Thus,
it doesn't need to hold a reference to struct cros_ec_dev.
The 3rd patch returns an error when trying to send commands through an
underlying protocol device which either hasn't been registered or has gone.
The 4th patch introduces a new helper cros_ec_device_alloc() for allocating
struct cros_ec_device properly (including to initialize the kref).
The 5th patch lets the fops hold the kref when the file is opening.
The 6th patch starts to manage struct cros_ec_device's lifecycle by the kref.
[1] https://patchwork.kernel.org/project/chrome-platform/patch/20250703113509.2511758-3-tzungbi@kernel.org/
Tzung-Bi Shih (6):
platform/chrome: cros_ec_chardev: Remove redundant struct field
platform/chrome: cros_ec_chardev: Decouple fops from struct
cros_ec_dev
platform/chrome: Disallow sending commands through unregistered ec_dev
platform/chrome: Introduce cros_ec_device_alloc()
platform/chrome: cros_ec_chardev: Hold refcount of struct
cros_ec_device
platform/chrome: Manage struct cros_ec_device lifecycle by its
refcount
drivers/platform/chrome/cros_ec.c | 13 +++-
drivers/platform/chrome/cros_ec_chardev.c | 74 ++++++++++-----------
drivers/platform/chrome/cros_ec_i2c.c | 4 +-
drivers/platform/chrome/cros_ec_ishtp.c | 9 ++-
drivers/platform/chrome/cros_ec_lpc.c | 11 +--
drivers/platform/chrome/cros_ec_proto.c | 53 +++++++++++++++
drivers/platform/chrome/cros_ec_rpmsg.c | 20 ++++--
drivers/platform/chrome/cros_ec_spi.c | 10 +--
drivers/platform/chrome/cros_ec_uart.c | 17 +++--
include/linux/platform_data/cros_ec_proto.h | 9 +++
10 files changed, 153 insertions(+), 67 deletions(-)
--
2.50.0.727.gbf7dc18ff4-goog
next reply other threads:[~2025-07-08 8:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 8:00 Tzung-Bi Shih [this message]
2025-07-08 8:00 ` [PATCH v2 1/6] platform/chrome: cros_ec_chardev: Remove redundant struct field Tzung-Bi Shih
2025-07-08 8:00 ` [PATCH v2 2/6] platform/chrome: cros_ec_chardev: Decouple fops from struct cros_ec_dev Tzung-Bi Shih
2025-07-08 8:00 ` [PATCH v2 3/6] platform/chrome: Disallow sending commands through unregistered ec_dev Tzung-Bi Shih
2025-07-08 8:00 ` [PATCH v2 4/6] platform/chrome: Introduce cros_ec_device_alloc() Tzung-Bi Shih
2025-07-08 8:00 ` [PATCH v2 5/6] platform/chrome: cros_ec_chardev: Hold refcount of struct cros_ec_device Tzung-Bi Shih
2025-07-08 8:00 ` [PATCH v2 6/6] platform/chrome: Manage struct cros_ec_device lifecycle by its refcount 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=20250708080034.3425427-1-tzungbi@kernel.org \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dawidn@google.com \
--cc=gregkh@linuxfoundation.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