From: Emil Velikov Subject: [PATCH 13/14] drm/nouveau/perf: Prevent buffer oveflow Date: Mon, 21 May 2012 00:15:02 +0100 Message-ID: <1337555703-18925-14-git-send-email-emil.l.velikov@gmail.com> References: <1337555703-18925-1-git-send-email-emil.l.velikov@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1337555703-18925-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org 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 --- 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