aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2016-06-22 12:41:04 +1000
committerBen Skeggs <bskeggs@redhat.com>2016-07-14 11:53:25 +1000
commit2f96e8e3e0226d74ca62544d3c9f3558e55b6bb2 (patch)
tree8f324be15ad5387dc51f0b28d6fafbee850dfe20 /drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
parentdrm/nouveau/bios: guard against out-of-bounds accesses to image (diff)
downloadlinux-dev-2f96e8e3e0226d74ca62544d3c9f3558e55b6bb2.tar.xz
linux-dev-2f96e8e3e0226d74ca62544d3c9f3558e55b6bb2.zip
drm/nouveau/bios: pointers beyond end of first image need special handling
Makes common the code that was previously used by the PMU table parsing, as it appears other tables need this too. Not much of an idea what this is all about... Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
index 74b14cf09308..1dbff7aeafec 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
@@ -68,11 +68,16 @@ nvbios_imagen(struct nvkm_bios *bios, struct nvbios_image *image)
bool
nvbios_image(struct nvkm_bios *bios, int idx, struct nvbios_image *image)
{
+ u32 imaged_addr = bios->imaged_addr;
memset(image, 0x00, sizeof(*image));
+ bios->imaged_addr = 0;
do {
image->base += image->size;
- if (image->last || !nvbios_imagen(bios, image))
+ if (image->last || !nvbios_imagen(bios, image)) {
+ bios->imaged_addr = imaged_addr;
return false;
+ }
} while(idx--);
+ bios->imaged_addr = imaged_addr;
return true;
}