* [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names
[not found] <20260525202921.124698-1-dakr@kernel.org>
@ 2026-05-25 20:20 ` Danilo Krummrich
2026-05-26 0:38 ` Eliot Courtney
2026-05-26 2:22 ` Alexandre Courbot
0 siblings, 2 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-05-25 20:20 UTC (permalink / raw)
To: gregkh, rafael, acourbot, aliceryhl, david.m.ertman, ira.weiny,
leon, viresh.kumar, m.wilczynski, ukleinek, bhelgaas, kwilczynski,
abdiel.janulgue, robin.murphy, markus.probst, ojeda, boqun, gary,
bjorn3_gh, lossin, a.hindborg, tmgross, igor.korotin,
daniel.almeida, pcolberg
Cc: driver-core, linux-kernel, nova-gpu, dri-devel, linux-pm,
linux-pwm, linux-pci, rust-for-linux, Danilo Krummrich, stable,
Sashiko
pci_request_region() stores the name pointer directly in struct
resource; use &'static CStr to ensure the pointer remains valid even if
the Bar is leaked.
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260522004943.CDA7C1F000E9@smtp.kernel.org/
Fixes: 3c2e31d717ac ("rust: pci: move I/O infrastructure to separate file")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
rust/kernel/pci/io.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/pci/io.rs b/rust/kernel/pci/io.rs
index ae78676c927f..3ce21482b079 100644
--- a/rust/kernel/pci/io.rs
+++ b/rust/kernel/pci/io.rs
@@ -153,7 +153,7 @@ pub struct Bar<const SIZE: usize = 0> {
}
impl<const SIZE: usize> Bar<SIZE> {
- pub(super) fn new(pdev: &Device, num: u32, name: &CStr) -> Result<Self> {
+ pub(super) fn new(pdev: &Device, num: u32, name: &'static CStr) -> Result<Self> {
let len = pdev.resource_len(num)?;
if len == 0 {
return Err(ENOMEM);
@@ -252,7 +252,7 @@ impl Device<device::Bound> {
pub fn iomap_region_sized<'a, const SIZE: usize>(
&'a self,
bar: u32,
- name: &'a CStr,
+ name: &'static CStr,
) -> impl PinInit<Devres<Bar<SIZE>>, Error> + 'a {
Devres::new(self.as_ref(), Bar::<SIZE>::new(self, bar, name))
}
@@ -261,7 +261,7 @@ pub fn iomap_region_sized<'a, const SIZE: usize>(
pub fn iomap_region<'a>(
&'a self,
bar: u32,
- name: &'a CStr,
+ name: &'static CStr,
) -> impl PinInit<Devres<Bar>, Error> + 'a {
self.iomap_region_sized::<0>(bar, name)
}
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names
2026-05-25 20:20 ` [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names Danilo Krummrich
@ 2026-05-26 0:38 ` Eliot Courtney
2026-05-26 2:22 ` Alexandre Courbot
1 sibling, 0 replies; 3+ messages in thread
From: Eliot Courtney @ 2026-05-26 0:38 UTC (permalink / raw)
To: Danilo Krummrich, gregkh, rafael, acourbot, aliceryhl,
david.m.ertman, ira.weiny, leon, viresh.kumar, m.wilczynski,
ukleinek, bhelgaas, kwilczynski, abdiel.janulgue, robin.murphy,
markus.probst, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
tmgross, igor.korotin, daniel.almeida, pcolberg
Cc: driver-core, linux-kernel, nova-gpu, dri-devel, linux-pm,
linux-pwm, linux-pci, rust-for-linux, stable, Sashiko, dri-devel
On Tue May 26, 2026 at 5:20 AM JST, Danilo Krummrich wrote:
> pci_request_region() stores the name pointer directly in struct
> resource; use &'static CStr to ensure the pointer remains valid even if
> the Bar is leaked.
>
> Cc: stable@vger.kernel.org
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/20260522004943.CDA7C1F000E9@smtp.kernel.org/
> Fixes: 3c2e31d717ac ("rust: pci: move I/O infrastructure to separate file")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names
2026-05-25 20:20 ` [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names Danilo Krummrich
2026-05-26 0:38 ` Eliot Courtney
@ 2026-05-26 2:22 ` Alexandre Courbot
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2026-05-26 2:22 UTC (permalink / raw)
To: Danilo Krummrich
Cc: gregkh, rafael, aliceryhl, david.m.ertman, ira.weiny, leon,
viresh.kumar, m.wilczynski, ukleinek, bhelgaas, kwilczynski,
abdiel.janulgue, robin.murphy, markus.probst, ojeda, boqun, gary,
bjorn3_gh, lossin, a.hindborg, tmgross, igor.korotin,
daniel.almeida, pcolberg, driver-core, linux-kernel, nova-gpu,
dri-devel, linux-pm, linux-pwm, linux-pci, rust-for-linux, stable,
Sashiko
On Tue May 26, 2026 at 5:20 AM JST, Danilo Krummrich wrote:
> pci_request_region() stores the name pointer directly in struct
> resource; use &'static CStr to ensure the pointer remains valid even if
> the Bar is leaked.
>
> Cc: stable@vger.kernel.org
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/20260522004943.CDA7C1F000E9@smtp.kernel.org/
> Fixes: 3c2e31d717ac ("rust: pci: move I/O infrastructure to separate file")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-26 2:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260525202921.124698-1-dakr@kernel.org>
2026-05-25 20:20 ` [PATCH v5 01/24] rust: pci: use 'static lifetime for PCI BAR resource names Danilo Krummrich
2026-05-26 0:38 ` Eliot Courtney
2026-05-26 2:22 ` Alexandre Courbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox