[PATCH v3 0/2] cxl/region: Fix race conditions in cxl region unregistration.
From: Sungwoo Kim
Date: Sun Apr 26 2026 - 23:26:31 EST
This version mainly addresses Dave's comments and meaningful issues reported by Sashiko AI[1].
Overview
========
This patch series fixes race conditions in cxl region unregistration.
devm_release_action() should be called once, otherwise, it warns about
the second call. However, the current implementation has a race condition
that allows multiple calls to devm_release_action(). The details are in
each patch.
To fix these, the first patch adds a new function that guarantees that
devm_release_action() is called only once.
Using this function, the second patch subsitutes the current use of
devm_release_action() in cxl region with the new function.
Change in v3
============
Addressed Dave's comments:
- Split and made this in a patch series.
- Enhanced a commit log explaining why a workqueue is used in the first patch.
- Added a context on how these issues were found and what impact was observed and how that effects a user in the second patch.
Sashiko AI review fixes:
- Fixed construct_region() as it also can race.
- Used a driver's wq instead of system wq so unbinding can drain a work.
[1] https://sashiko.dev/#/patchset/20260422045637.3048249-2-iam%40sung-woo.kim
Earlier approach:
v2: https://lore.kernel.org/linux-cxl/20260422045637.3048249-2-iam@xxxxxxxxxxxx/
v1: https://lore.kernel.org/linux-cxl/20260308185958.2453707-2-iam@xxxxxxxxxxxx/
Sungwoo Kim (2):
cxl/region: serialize devm action removal via scheduled work
cxl/region: Fix a race bug in delete_region_store()
drivers/cxl/core/port.c | 6 +++++
drivers/cxl/core/region.c | 47 ++++++++++++++++++++++++++++++++++-----
drivers/cxl/cxl.h | 9 ++++++++
3 files changed, 57 insertions(+), 5 deletions(-)
--
2.47.3