Re: [PATCH] rust: devres: do not dereference to the internal Revocable
From: Benno Lossin
Date: Thu Jun 12 2025 - 04:49:46 EST
On Wed Jun 11, 2025 at 7:48 PM CEST, Danilo Krummrich wrote:
> We can't expose direct access to the internal Revocable, since this
> allows users to directly revoke the internal Revocable without Devres
> having the chance to synchronize with the devres callback -- we have to
> guarantee that the internal Revocable has been fully revoked before
> the device is fully unbound.
>
> Hence, remove the corresponding Deref implementation and, instead,
> provide indirect accessors for the internal Revocable.
>
> Note that we can still support Devres::revoke() by implementing the
> required synchronization (which would be almost identical to the
> synchronization in Devres::drop()).
>
> Fixes: 76c01ded724b ("rust: add devres abstraction")
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
---
Cheers,
Benno
> ---
> This patch is based on [1].
>
> [1] https://lore.kernel.org/lkml/20250603205416.49281-1-dakr@xxxxxxxxxx/
> ---
> rust/kernel/devres.rs | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)