Skip to content

rust: revocable: fix potential race between concurrent revokers

Danilo Krummrich driver-core rust-for-linux stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2pin-init: add PinInit::map_err() for error type conversionrust/pin-init/src/lib.rs+44 -00 replies
2/2rust: revocable: fix race between concurrent revokersrust/kernel/revocable.rs+20 -33 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] rust: revocable: fix potential race between concurrent revokers

Fix a race condition caused by not considering that Revocable does not guarantee the wrapped object has been fully dropped by the time revoke() or revoke_nosync() returns false.

There is currently no actual bug caused by this, but it causes SGTable and Lyude's patch in [1] to be unsound.

Since Completion::new() is infallible but Revocable::new() is generic over the error type, the first patch adds PinInit::map_err() to bridge the error type mismatch.

This can either go separately or together with Lyude's patch. Both cases are unlikely to ever hit this problem, so it should be fine either way.

[1] https://lore.kernel.org/dri-devel/[email protected]/

Danilo Krummrich (2):
pin-init: add PinInit::map_err() for error type conversion
rust: revocable: fix race between concurrent revokers

 rust/kernel/revocable.rs | 23 ++++++++++++++++++---
 rust/pin-init/src/lib.rs | 44 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 3 deletions(-)

base-commit: 66affa37cfac0aec061cc4bcf4a065b0c52f7e19

Signature · 1 line
2.54.0