Skip to content

Fix race condition in Devres

Danilo Krummrich lkml rust-for-linux 2 versions – Applied

Status from this message: Applied to driver-core-linus, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 4 repliesApplied
  2. v13 patches 24 repliesSuperseded

Changes in v2 from the cover letter

- Completion
- s/can queue themselves up/have been queued up/
- move up Send / Sync impl
- refer to complete_all() from wait_for_completion()
- clarify "permanentely done" with "i.e. signals all current and future waiters"
- Devres
- pick more appropriate 'Fixes' tag
- extend commit message with an illustration of the race

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3rust: completion: implement initial abstractionrust/bindings/bindings_helper.h rust/helpers/completion.c rust/helpers/helpers.c +2 more+124 -01 reply
2/3rust: revocable: indicate whether `data` has been revoked alreadyrust/kernel/revocable.rs+14 -41 reply
3/3rust: devres: fix race in Devres::drop()rust/kernel/devres.rs+26 -71 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAlice RyhlBoqun FengBenno LossinMiguel Ojeda
1/3R-b R-b R-b A-b
2/3R-b A-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/3] Fix race condition in Devres

This patch series fixes a race condition in Devres.

Please see patch 3 "rust: devres: fix race in Devres::drop()" for a detailed description of the race and how it is fixed.

None of the upstream users of Devres is prone to this race, hence we do not necessarily have to backport this -- yet, it must be fixed.

Thanks to Alice for catching and reporting this!

A branch containing those patches can be found in [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/devres-race

Changes in v2:
- Completion
- s/can queue themselves up/have been queued up/
- move up Send / Sync impl
- refer to complete_all() from wait_for_completion()
- clarify "permanentely done" with "i.e. signals all current and future waiters"
- Devres
- pick more appropriate 'Fixes' tag
- extend commit message with an illustration of the race

Danilo Krummrich (3):
rust: completion: implement initial abstraction
rust: revocable: indicate whether data has been revoked already
rust: devres: fix race in Devres::drop()

 rust/bindings/bindings_helper.h |   1 +
 rust/helpers/completion.c       |   8 +++
 rust/helpers/helpers.c          |   1 +
 rust/kernel/devres.rs           |  33 ++++++++--
 rust/kernel/revocable.rs        |  18 +++--
 rust/kernel/sync.rs             |   2 +
 rust/kernel/sync/completion.rs  | 112 ++++++++++++++++++++++++++++++++
 7 files changed, 164 insertions(+), 11 deletions(-)
 create mode 100644 rust/helpers/completion.c
 create mode 100644 rust/kernel/sync/completion.rs

base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494

Signature · 1 line
2.49.0