[PATCH 0/3] platform/chrome: Fix a possible UAF via ref_proxy

Tzung-Bi Shih posted 3 patches 1 month, 3 weeks ago
drivers/platform/chrome/Kconfig             |   8 +-
drivers/platform/chrome/cros_ec_chardev.c   | 125 ++++++++-----
drivers/platform/chrome/cros_ec_i2c.c       |   5 +
drivers/platform/chrome/cros_ec_ishtp.c     |   5 +
drivers/platform/chrome/cros_ec_lpc.c       |   5 +
drivers/platform/chrome/cros_ec_rpmsg.c     |   5 +
drivers/platform/chrome/cros_ec_spi.c       |   4 +
drivers/platform/chrome/cros_ec_uart.c      |   5 +
include/linux/platform_data/cros_ec_proto.h |   3 +
include/linux/ref_proxy.h                   |  37 ++++
lib/Kconfig                                 |   3 +
lib/Makefile                                |   1 +
lib/ref_proxy.c                             | 184 ++++++++++++++++++++
13 files changed, 348 insertions(+), 42 deletions(-)
create mode 100644 include/linux/ref_proxy.h
create mode 100644 lib/ref_proxy.c
[PATCH 0/3] platform/chrome: Fix a possible UAF via ref_proxy
Posted by Tzung-Bi Shih 1 month, 3 weeks ago
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 a newly introduced ref_proxy library.

The 1st patch introduces the ref_proxy which is an implementation of ideas
from the talk [2].

The 2nd patch converts existing protocol devices to resource providers
of cros_ec_device.

The 3rd patch converts cros_ec_chardev to a resource consumer of
cros_ec_device to fix the UAF.

[1] https://lore.kernel.org/chrome-platform/20250721044456.2736300-6-tzungbi@kernel.org/
[2] https://lpc.events/event/17/contributions/1627/

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>

Tzung-Bi Shih (3):
  lib: Add ref_proxy module
  platform/chrome: Protect cros_ec_device lifecycle with ref_proxy
  platform/chrome: cros_ec_chardev: Consume cros_ec_device via ref_proxy

 drivers/platform/chrome/Kconfig             |   8 +-
 drivers/platform/chrome/cros_ec_chardev.c   | 125 ++++++++-----
 drivers/platform/chrome/cros_ec_i2c.c       |   5 +
 drivers/platform/chrome/cros_ec_ishtp.c     |   5 +
 drivers/platform/chrome/cros_ec_lpc.c       |   5 +
 drivers/platform/chrome/cros_ec_rpmsg.c     |   5 +
 drivers/platform/chrome/cros_ec_spi.c       |   4 +
 drivers/platform/chrome/cros_ec_uart.c      |   5 +
 include/linux/platform_data/cros_ec_proto.h |   3 +
 include/linux/ref_proxy.h                   |  37 ++++
 lib/Kconfig                                 |   3 +
 lib/Makefile                                |   1 +
 lib/ref_proxy.c                             | 184 ++++++++++++++++++++
 13 files changed, 348 insertions(+), 42 deletions(-)
 create mode 100644 include/linux/ref_proxy.h
 create mode 100644 lib/ref_proxy.c

-- 
2.51.0.rc1.163.g2494970778-goog