Commit d1626a96 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios: fetch full 4KiB block to determine ACPI ROM image size

Buggy firmware leads to bad things happening otherwise..
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 00e4845b
...@@ -192,7 +192,6 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) ...@@ -192,7 +192,6 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
{ {
struct pci_dev *pdev = nv_device(bios)->pdev; struct pci_dev *pdev = nv_device(bios)->pdev;
int ret, cnt, i; int ret, cnt, i;
u8 data[3];
if (!nouveau_acpi_rom_supported(pdev)) { if (!nouveau_acpi_rom_supported(pdev)) {
bios->data = NULL; bios->data = NULL;
...@@ -200,8 +199,13 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) ...@@ -200,8 +199,13 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
} }
bios->size = 0; bios->size = 0;
if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) bios->data = kmalloc(4096, GFP_KERNEL);
bios->size = data[2] * 512; if (bios->data) {
if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096)
bios->size = bios->data[2] * 512;
kfree(bios->data);
}
if (!bios->size) if (!bios->size)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment