The returned slice is derived from `out`, but lifetime elision ties it to `self` because this is a method. Explicitly bind the return lifetime to `out` so the returned slice cannot outlive its backing buffer. Fixes: 06cb58b310ea ("rust: iov: add iov_iter abstractions for ITER_SOURCE") Cc: stable@vger.kernel.org Reported-by: spidermana Closes: https://github.com/Rust-for-Linux/linux/issues/1265 Signed-off-by: Marwan Mohamed Zein --- v2: - Use full name in author and sign-off. - Add Fixes and Cc: stable tags as suggested by Miguel Ojeda. rust/kernel/iov.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/iov.rs b/rust/kernel/iov.rs index 43bae8923..8caf04518 100644 --- a/rust/kernel/iov.rs +++ b/rust/kernel/iov.rs @@ -161,7 +161,7 @@ pub fn copy_from_iter_vec( /// /// This will never write uninitialized bytes to the provided buffer. #[inline] - pub fn copy_from_iter_raw(&mut self, out: &mut [MaybeUninit]) -> &mut [u8] { + pub fn copy_from_iter_raw<'a>(&mut self, out: &'a mut [MaybeUninit]) -> &'a mut [u8] { let capacity = out.len(); let out = out.as_mut_ptr().cast::(); base-commit: ee83899302a0457a3ba47464a13e8682bd7ba27d -- 2.47.3