[PATCH v3] rust: workqueue: fix SAFETY comment incorrectly referencing `Arc`

From: Sagar Taunk

Date: Sun Oct 25 2026 - 07:43:59 EST


The `WorkItemPointer` implementation for `Pin<KBox<T>>` incorrectly
references `Arc::into_raw` when `KBox::into_raw` has been used.

Fixes: 47f0dbe8fdc2 ("rust: workqueue: implement `WorkItemPointer` for pointer types")
Reported-by: Onur Özkan <work@xxxxxxxxxxxxx>
Closes: https://github.com/Rust-for-Linux/linux/issues/1233
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Reviewed-by: Onur Özkan <work@xxxxxxxxxxxxx>
Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
Signed-off-by: Sagar Taunk <sagartaunk@xxxxxxxxx>
---
I originally sent this patch in April but it was not merged because I messed up on
the tags. I remembered that I failed to follow up on this while trying to read this module.

Changes in v3:
Fix tags.
Link to v2: https://lore.kernel.org/all/20260426175317.10171-1-sagartaunk2@xxxxxxxxx/
Link to v1: https://lore.kernel.org/all/20260425135701.34010-1-sagartaunk2@xxxxxxxxx/
rust/kernel/workqueue.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
index 7e253b6f299c..2c07785d446e 100644
--- a/rust/kernel/workqueue.rs
+++ b/rust/kernel/workqueue.rs
@@ -890,9 +890,9 @@ unsafe impl<T, const ID: u64> WorkItemPointer<ID> for Pin<KBox<T>>
unsafe extern "C" fn run(ptr: *mut bindings::work_struct) {
// The `__enqueue` method always uses a `work_struct` stored in a `Work<T, ID>`.
let ptr = ptr.cast::<Work<T, ID>>();
- // SAFETY: This computes the pointer that `__enqueue` got from `Arc::into_raw`.
+ // SAFETY: This computes the pointer that `__enqueue` got from `KBox::into_raw`.
let ptr = unsafe { T::work_container_of(ptr) };
- // SAFETY: This pointer comes from `Arc::into_raw` and we've been given back ownership.
+ // SAFETY: This pointer comes from `KBox::into_raw` and we've been given back ownership.
let boxed = unsafe { KBox::from_raw(ptr) };
// SAFETY: The box was already pinned when it was enqueued.
let pinned = unsafe { Pin::new_unchecked(boxed) };
--
2.56.0