* [PATCH] drm/nouveau: fix ramht wraparound
@ 2012-12-20 22:37 Marcin Slusarz
[not found] ` <1356043034-25739-5-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Slusarz @ 2012-12-20 22:37 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: stable-u79uwXL29TY76Z2rM5mHXA
When hash collision occurs and it's near ramht object boundary, we could
read and possibly overwrite some memory after ramht object.
Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/gpu/drm/nouveau/core/core/ramht.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/core/core/ramht.c b/drivers/gpu/drm/nouveau/core/core/ramht.c
index 86a6404..6da314c 100644
--- a/drivers/gpu/drm/nouveau/core/core/ramht.c
+++ b/drivers/gpu/drm/nouveau/core/core/ramht.c
@@ -59,7 +59,7 @@ nouveau_ramht_insert(struct nouveau_ramht *ramht, int chid,
}
co += 8;
- if (co >= nv_gpuobj(ramht)->size)
+ if (co + 8 > nv_gpuobj(ramht)->size)
co = 0;
} while (co != ho);
--
1.8.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1356043034-25739-5-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] drm/nouveau: fix ramht wraparound [not found] ` <1356043034-25739-5-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2012-12-21 0:15 ` Ben Skeggs [not found] ` <20121221001548.GA3839-6RkuLLNOGXsZ315U/fw+0NvLeJWuRmrY@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Ben Skeggs @ 2012-12-21 0:15 UTC (permalink / raw) To: Marcin Slusarz Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, stable-u79uwXL29TY76Z2rM5mHXA On Thu, Dec 20, 2012 at 11:37:12PM +0100, Marcin Slusarz wrote: > When hash collision occurs and it's near ramht object boundary, we could > read and possibly overwrite some memory after ramht object. > > Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > --- > drivers/gpu/drm/nouveau/core/core/ramht.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/core/core/ramht.c b/drivers/gpu/drm/nouveau/core/core/ramht.c > index 86a6404..6da314c 100644 > --- a/drivers/gpu/drm/nouveau/core/core/ramht.c > +++ b/drivers/gpu/drm/nouveau/core/core/ramht.c > @@ -59,7 +59,7 @@ nouveau_ramht_insert(struct nouveau_ramht *ramht, int chid, > } > > co += 8; > - if (co >= nv_gpuobj(ramht)->size) > + if (co + 8 > nv_gpuobj(ramht)->size) I might just be really tired, but, how exactly is the original wrong? The original could even just be (co == size) and still work correctly as far as I can tell. Ben. > co = 0; > } while (co != ho); > > -- > 1.8.0.2 > > _______________________________________________ > Nouveau mailing list > Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > http://lists.freedesktop.org/mailman/listinfo/nouveau ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20121221001548.GA3839-6RkuLLNOGXsZ315U/fw+0NvLeJWuRmrY@public.gmane.org>]
* Re: [PATCH] drm/nouveau: fix ramht wraparound [not found] ` <20121221001548.GA3839-6RkuLLNOGXsZ315U/fw+0NvLeJWuRmrY@public.gmane.org> @ 2012-12-21 8:02 ` Marcin Slusarz 0 siblings, 0 replies; 3+ messages in thread From: Marcin Slusarz @ 2012-12-21 8:02 UTC (permalink / raw) To: Ben Skeggs; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On Fri, Dec 21, 2012 at 10:15:48AM +1000, Ben Skeggs wrote: > On Thu, Dec 20, 2012 at 11:37:12PM +0100, Marcin Slusarz wrote: > > When hash collision occurs and it's near ramht object boundary, we could > > read and possibly overwrite some memory after ramht object. > > > > Signed-off-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > --- > > drivers/gpu/drm/nouveau/core/core/ramht.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/nouveau/core/core/ramht.c b/drivers/gpu/drm/nouveau/core/core/ramht.c > > index 86a6404..6da314c 100644 > > --- a/drivers/gpu/drm/nouveau/core/core/ramht.c > > +++ b/drivers/gpu/drm/nouveau/core/core/ramht.c > > @@ -59,7 +59,7 @@ nouveau_ramht_insert(struct nouveau_ramht *ramht, int chid, > > } > > > > co += 8; > > - if (co >= nv_gpuobj(ramht)->size) > > + if (co + 8 > nv_gpuobj(ramht)->size) > I might just be really tired, but, how exactly is the original wrong? > The original could even just be (co == size) and still work correctly as > far as I can tell. Ah, crap, I didn't see that both hash value and ramht->size are divisible by 8. So original code is correct (although it relies on the above) and my version does not really fix anything. Marcin ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-21 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 22:37 [PATCH] drm/nouveau: fix ramht wraparound Marcin Slusarz
[not found] ` <1356043034-25739-5-git-send-email-marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-21 0:15 ` Ben Skeggs
[not found] ` <20121221001548.GA3839-6RkuLLNOGXsZ315U/fw+0NvLeJWuRmrY@public.gmane.org>
2012-12-21 8:02 ` Marcin Slusarz
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.