[PATCH v2 11/11] gpu: nova-core: vbios: reject extra PCI-AT and FWSEC images

From: Eliot Courtney

Date: Tue Apr 14 2026 - 07:56:57 EST


Currently, these are silently overwritten. Instead, error if they appear
twice in the VBIOS.

Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
drivers/gpu/nova-core/vbios.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 5cc251c73800..a9294b68ea77 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -251,13 +251,20 @@ pub(crate) fn new(dev: &device::Device, bar0: &Bar0) -> Result<Vbios> {
// Convert to a specific image type
match BiosImageType::try_from(image.pcir.code_type) {
Ok(BiosImageType::PciAt) => {
+ if pci_at_image.is_some() {
+ dev_err!(dev, "More than 1 PCI-AT image found\n");
+ return Err(EINVAL);
+ }
pci_at_image = Some(PciAtBiosImage::try_from(image)?);
}
Ok(BiosImageType::FwSec) => {
if first_fwsec_image.is_none() {
first_fwsec_image = Some(image);
- } else {
+ } else if second_fwsec_image.is_none() {
second_fwsec_image = Some(image);
+ } else {
+ dev_err!(dev, "More than 2 FwSec images found\n");
+ return Err(EINVAL);
}
}
_ => {

--
2.53.0