linux/rust
Sophon Zhang 8d7b3e41ff rust: pci: reject IRQ vector indices that do not fit in u32
IrqVectorRegistration::index() accepts a usize, but pci_irq_vector()
takes an unsigned int. On 64-bit architectures, casting an index larger
than u32::MAX wraps it before the PCI core can validate it. In
particular, u32::MAX + 1 becomes zero and can resolve to the first
allocated vector.

Use a checked conversion and return EINVAL when the index cannot be
represented by the C API.

Fixes: 2fb7755b0a ("rust: pci: resolve IRQ in index() and embed IrqRequest in IrqVector")
Signed-off-by: Sophon Zhang <aiqubits@hotmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260901-fix-pci-irq-vector-index-truncation-v4-1-f94aa6932fd9@hotmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-09-01 18:21:01 +02:00
..
bindings Char/Misc/IIO/etc driver update for 7.3-rc1 2026-08-25 09:38:50 -07:00
helpers Char/Misc/IIO/etc driver update for 7.3-rc1 2026-08-25 09:38:50 -07:00
kernel rust: pci: reject IRQ vector indices that do not fit in u32 2026-09-01 18:21:01 +02:00
macros Modules changes for 7.3-rc1 2026-08-21 12:47:25 -07:00
pin-init
proc-macro2
quote
syn
uapi Char/Misc/IIO/etc driver update for 7.3-rc1 2026-08-25 09:38:50 -07:00
zerocopy
zerocopy-derive
.gitignore
.kunitconfig
bindgen_parameters
build_error.rs
compiler_builtins.rs
exports.c
ffi.rs
Makefile Rust fixes for v7.3 2026-08-30 09:47:39 -07:00