char: misc: Introduce misc_sync to fix UAF
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest8 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | char: misc: Simplify locking with guard()drivers/ | +11 | 0 replies | |
| 2/8 | char: misc: Introduce misc_find() helperdrivers/ | +23 | 0 replies | |
| 3/8 | char: misc: Introduce misc_sync_register()drivers/ include/ | +132 | 5 replies | |
| 4/8 | char: misc: Use SRCU to protect list traversaldrivers/ | +48 | 0 replies | |
| 5/8 | platform/chrome: cros_ec_chardev: Introduce chardev_datadrivers/ | +39 | 0 replies | |
| 6/8 | platform/chrome: cros_ec_chardev: Move data to chardev_pdatadrivers/ | +20 | 0 replies | |
| 7/8 | platform/chrome: cros_ec_chardev: Add event relayerdrivers/ | +29 | 0 replies | |
| 8/8 | platform/chrome: cros_ec_chardev: Use misc_sync_register()drivers/ | +1 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/8] char: misc: Introduce misc_sync to fix UAF
This series introduces misc_sync to address potential Use-After-Free errors when a device is deregistered while file operations are still in progress or files remain open. It then adopts the mechanism in cros_ec_chardev driver.
- Patches 1 and 2 are independent refactors in the misc subsystem. These are safe cleanups and should be fine to apply.
- Patch 3 is the initial Proof-of-Concept for misc_sync. It uses a global lock to serialize file operations, so a performance downgrade is expected.
- Patch 4 is an improvement over the PoC that replaces the global lock with SRCU for list traversal in the file operations, avoiding performance bottlenecks.
- Patches 5 to 7 are preparation steps in cros_ec_chardev driver. They introduce reference counting for platform driver data and an event relayer. This removes the direct access to ec_dev->event_notifier in cros_ec_chardev_release(), which is a prerequisite for using misc_sync safely in this driver.
- Patch 8 switches cros_ec_chardev driver to use misc_sync.
Tzung-Bi Shih (8):
char: misc: Simplify locking with guard()
char: misc: Introduce misc_find() helper
char: misc: Introduce misc_sync_register()
char: misc: Use SRCU to protect list traversal platform/chrome: cros_ec_chardev: Introduce chardev_data platform/chrome: cros_ec_chardev: Move data to chardev_pdata platform/chrome: cros_ec_chardev: Add event relayer platform/chrome: cros_ec_chardev: Use misc_sync_register()
drivers/char/misc.c | 228 +++++++++++++++++----- drivers/platform/chrome/cros_ec_chardev.c | 113 ++++++++--- include/linux/miscdevice.h | 10 + 3 files changed, 272 insertions(+), 79 deletions(-)
Signature · 1 line
2.51.0