If the vbios is corrupted it can indicate more performance entries than the
ones statically allocated, causing overwriting of kernel memory

Signed-off-by: Emil Velikov <[email protected]>
---
 drivers/gpu/drm/nouveau/nouveau_perf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c 
b/drivers/gpu/drm/nouveau/nouveau_perf.c
index af03fb4..36a9ae3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_perf.c
+++ b/drivers/gpu/drm/nouveau/nouveau_perf.c
@@ -61,7 +61,7 @@ nouveau_perf_entry(struct nouveau_device *ndev, int idx,
                   u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
 {
        u8 *perf = nouveau_perf_table(ndev, ver);
-       if (perf) {
+       if (perf && idx < NOUVEAU_PM_MAX_LEVEL) {
                if (*ver >= 0x12 && *ver < 0x20 && idx < perf[2]) {
                        *hdr = perf[3];
                        *cnt = 0;
-- 
1.7.10.2

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to