From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Danilo Krummrich <dakr@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 4/4] rust: devres: do not dereference to the internal Revocable
Date: Wed, 25 Jun 2025 10:09:09 -0400 [thread overview]
Message-ID: <20250625000020-eee23bb2602b3e90@stable.kernel.org> (raw)
In-Reply-To: <20250624135856.60250-5-dakr@kernel.org>
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: 20c96ed278e362ae4e324ed7d8c69fb48c508d3c
Note: The patch differs from the upstream commit:
---
1: 20c96ed278e36 ! 1: c56dfa9d4bad7 rust: devres: do not dereference to the internal Revocable
@@ Metadata
## Commit message ##
rust: devres: do not dereference to the internal Revocable
+ [ Upstream commit 20c96ed278e362ae4e324ed7d8c69fb48c508d3c ]
+
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
@@ rust/kernel/devres.rs
#[pin_data]
struct DevresInner<T> {
dev: ARef<Device>,
-@@ rust/kernel/devres.rs: pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> {
- // SAFETY: `dev` being the same device as the device this `Devres` has been created for
- // proves that `self.0.data` hasn't been revoked and is guaranteed to not be revoked as
- // long as `dev` lives; `dev` lives at least as long as `self`.
-- Ok(unsafe { self.deref().access() })
-+ Ok(unsafe { self.0.data.access() })
+@@ rust/kernel/devres.rs: pub fn new_foreign_owned(dev: &Device, data: T, flags: Flags) -> Result {
+
+ Ok(())
}
-}
@@ rust/kernel/devres.rs: pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Re
+ pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> {
+ self.0.data.try_access()
+ }
-+
-+ /// [`Devres`] accessor for [`Revocable::try_access_with`].
-+ pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> {
-+ self.0.data.try_access_with(f)
-+ }
- fn deref(&self) -> &Self::Target {
- &self.0.data
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.4.y | Success | Success |
prev parent reply other threads:[~2025-06-25 14:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 13:58 [PATCH 0/4] Devres fixes for v6.15.4 Danilo Krummrich
2025-06-24 13:58 ` [PATCH 1/4] rust: completion: implement initial abstraction Danilo Krummrich
2025-06-25 14:07 ` Sasha Levin
2025-06-24 13:58 ` [PATCH 2/4] rust: revocable: indicate whether `data` has been revoked already Danilo Krummrich
2025-06-25 14:09 ` Sasha Levin
2025-06-24 13:58 ` [PATCH 3/4] rust: devres: fix race in Devres::drop() Danilo Krummrich
2025-06-25 14:08 ` Sasha Levin
2025-06-24 13:58 ` [PATCH 4/4] rust: devres: do not dereference to the internal Revocable Danilo Krummrich
2025-06-25 14:09 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250625000020-eee23bb2602b3e90@stable.kernel.org \
--to=sashal@kernel.org \
--cc=dakr@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.