Skip to content

Commit

Permalink
drm/nouveau/bios: fetch full 4KiB block to determine ACPI ROM image size
Browse files Browse the repository at this point in the history
Buggy firmware leads to bad things happening otherwise..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Oct 22, 2012
1 parent 00e4845 commit d1626a9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/gpu/drm/nouveau/core/subdev/bios/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,20 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
{
struct pci_dev *pdev = nv_device(bios)->pdev;
int ret, cnt, i;
u8 data[3];

if (!nouveau_acpi_rom_supported(pdev)) {
bios->data = NULL;
return;
}

bios->size = 0;
if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
bios->size = data[2] * 512;
bios->data = kmalloc(4096, GFP_KERNEL);
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)
return;

Expand Down

0 comments on commit d1626a9

Please sign in to comment.