chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] platform/chrome: cros_ec_chardev: Fix a possible UAF
@ 2025-07-21  4:44 Tzung-Bi Shih
  2025-07-21  4:44 ` [PATCH v3 1/8] platform/chrome: cros_ec_chardev: Remove redundant struct field Tzung-Bi Shih
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Tzung-Bi Shih @ 2025-07-21  4:44 UTC (permalink / raw)
  To: bleung; +Cc: tzungbi, dawidn, gregkh, chrome-platform

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 and 2nd patches are clean-ups.

The 3rd 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 4th patch returns an error when trying to send commands through an
underlying protocol device which either hasn't been registered or has gone.

The 5th patch introduces a new helper cros_ec_device_alloc() for allocating
struct cros_ec_device properly (including to initialize the kref).

The 6th patch moves initialization of common utilities of struct cros_ec_device
to cros_ec_device_alloc() instead of staying in cros_ec_register() as the
object is still valid after unregistered.

The 7th patch lets the fops hold the kref when the file is opening.

The 8th 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/

Changes from v2 (https://patchwork.kernel.org/project/chrome-platform/cover/20250708080034.3425427-1-tzungbi@kernel.org/):
- The 2nd and 6th patches of the series are new.

Tzung-Bi Shih (8):
  platform/chrome: cros_ec_chardev: Remove redundant struct field
  platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()
  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: Don't initialize common utilities when registering
  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           | 25 +++----
 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     | 72 ++++++++++++++++++++
 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 | 10 +++
 10 files changed, 175 insertions(+), 77 deletions(-)

-- 
2.50.0.727.gbf7dc18ff4-goog


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2025-08-14  9:24 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21  4:44 [PATCH v3 0/8] platform/chrome: cros_ec_chardev: Fix a possible UAF Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 1/8] platform/chrome: cros_ec_chardev: Remove redundant struct field Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 2/8] platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister() Tzung-Bi Shih
2025-07-21  6:13   ` Greg KH
2025-07-21  9:30     ` Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 3/8] platform/chrome: cros_ec_chardev: Decouple fops from struct cros_ec_dev Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 4/8] platform/chrome: Disallow sending commands through unregistered ec_dev Tzung-Bi Shih
2025-07-21  5:47   ` Greg KH
2025-07-21  9:31     ` Tzung-Bi Shih
2025-07-21 10:23       ` Greg KH
2025-07-21  4:44 ` [PATCH v3 5/8] platform/chrome: Introduce cros_ec_device_alloc() Tzung-Bi Shih
2025-07-21  6:15   ` Greg KH
2025-07-24  9:58     ` Tzung-Bi Shih
2025-07-24 10:36       ` Greg KH
2025-07-24 13:32         ` Tzung-Bi Shih
2025-07-25  4:58           ` Greg KH
2025-08-01  7:25             ` Tzung-Bi Shih
2025-08-01  8:22               ` Greg KH
2025-08-01  8:41                 ` Tzung-Bi Shih
2025-08-01  8:50                   ` Greg KH
2025-08-14  9:24                     ` Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 6/8] platform/chrome: Don't initialize common utilities when registering Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 7/8] platform/chrome: cros_ec_chardev: Hold refcount of struct cros_ec_device Tzung-Bi Shih
2025-07-21  4:44 ` [PATCH v3 8/8] platform/chrome: Manage struct cros_ec_device lifecycle by its refcount Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).