public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] cxl/region: Fix race conditions in cxl region unregistration.
@ 2026-04-27  3:20 Sungwoo Kim
  2026-04-27  3:20 ` [PATCH v3 1/2] cxl/region: serialize devm action removal via scheduled work Sungwoo Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Sungwoo Kim @ 2026-04-27  3:20 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams, Robert Richter, Li Ming,
	Gregory Price, Ben Widawsky
  Cc: Dave Tian, Sungwoo Kim, linux-cxl, linux-kernel

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@sung-woo.kim/
v1: https://lore.kernel.org/linux-cxl/20260308185958.2453707-2-iam@sung-woo.kim/

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


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

end of thread, other threads:[~2026-04-30 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27  3:20 [PATCH v3 0/2] cxl/region: Fix race conditions in cxl region unregistration Sungwoo Kim
2026-04-27  3:20 ` [PATCH v3 1/2] cxl/region: serialize devm action removal via scheduled work Sungwoo Kim
2026-04-27 17:27   ` Dave Jiang
2026-04-27  3:20 ` [PATCH v3 2/2] cxl/region: Fix a race bug in delete_region_store() Sungwoo Kim
2026-04-27 12:51 ` [PATCH v3 0/2] cxl/region: Fix race conditions in cxl region unregistration Jonathan Cameron
2026-04-27 17:42 ` Dave Jiang
2026-04-28  5:42   ` Sungwoo Kim
2026-04-28 19:04     ` Dave Jiang
2026-04-28 20:28       ` Sungwoo Kim
2026-04-28 22:33         ` Dave Jiang
2026-04-30  4:39           ` Sungwoo Kim
2026-04-30 16:00             ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox