mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
PCI/VPD: Allow access to valid parts of VPD if some is invalid
Previously, if we found any error in the VPD, we returned size 0, which prevents access to all of VPD. But there may be valid resources in VPD before the error, and there's no reason to prevent access to those. "off" covers only VPD resources known to have valid header tags. In case of error, return "off" (which may be zero if we haven't found any valid header tags at all). Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
This commit is contained in:
parent
7fa75dd8c6
commit
5fe204eab1
@ -86,7 +86,7 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
|
|||||||
if (pci_read_vpd(dev, off + 1, 2, &header[1]) != 2) {
|
if (pci_read_vpd(dev, off + 1, 2, &header[1]) != 2) {
|
||||||
pci_warn(dev, "failed VPD read at offset %zu\n",
|
pci_warn(dev, "failed VPD read at offset %zu\n",
|
||||||
off + 1);
|
off + 1);
|
||||||
return 0;
|
return off;
|
||||||
}
|
}
|
||||||
size = pci_vpd_lrdt_size(header);
|
size = pci_vpd_lrdt_size(header);
|
||||||
if (off + size > PCI_VPD_MAX_SIZE)
|
if (off + size > PCI_VPD_MAX_SIZE)
|
||||||
@ -105,13 +105,13 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
|
|||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return off;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
pci_info(dev, "invalid VPD tag %#04x (size %zu) at offset %zu%s\n",
|
pci_info(dev, "invalid VPD tag %#04x (size %zu) at offset %zu%s\n",
|
||||||
header[0], size, off, off == 0 ?
|
header[0], size, off, off == 0 ?
|
||||||
"; assume missing optional EEPROM" : "");
|
"; assume missing optional EEPROM" : "");
|
||||||
return 0;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user