[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEr120wdhFVjFXWg@cassiopeiae>
Date: Thu, 12 Jun 2025 17:44:27 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...nel.org, aliceryhl@...gle.com,
tmgross@...ch.edu, chrisi.schrefl@...il.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] rust: devres: fix race in Devres::drop()
On Thu, Jun 12, 2025 at 08:24:57AM -0700, Boqun Feng wrote:
> Thanks for the explanation, and sorry I'm a bit late for the response. I
> was trying to find a place that we should document this, how about the
> diff below:
>
> ------------
> diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
> index 0f79a2ec9474..c8b9754e411b 100644
> --- a/rust/kernel/devres.rs
> +++ b/rust/kernel/devres.rs
> @@ -31,7 +31,8 @@ struct DevresInner<T> {
> /// manage their lifetime.
> ///
> /// [`Device`] bound resources should be freed when either the resource goes out of scope or the
> -/// [`Device`] is unbound respectively, depending on what happens first.
> +/// [`Device`] is unbound respectively, depending on what happens first. And if the resource goes
> +/// out of scope first, [`Device`] unbinding will wait until the resource being freed.
I will add
In any case, it is always guaranteed that revoking the device resource
is completed before the corresponding [`Device`] is unbound.
when applying the patch, if that's fine with you.
Powered by blists - more mailing lists