Skip to content

Commit 22c4eca

Browse files
Dan CarpenterZhengShunQian
authored andcommitted
drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply()
[ Upstream commit 7f073d0 ] The bo array has req->nr_buffers elements so the > should be >= so we don't read beyond the end of the array. Fixes: a1606a9 ("drm/nouveau: new gem pushbuf interface, bump to 0.0.16") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Ben Skeggs <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent faa0474 commit 22c4eca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_gem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
602602
struct nouveau_bo *nvbo;
603603
uint32_t data;
604604

605-
if (unlikely(r->bo_index > req->nr_buffers)) {
605+
if (unlikely(r->bo_index >= req->nr_buffers)) {
606606
NV_PRINTK(err, cli, "reloc bo index invalid\n");
607607
ret = -EINVAL;
608608
break;
@@ -612,7 +612,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
612612
if (b->presumed.valid)
613613
continue;
614614

615-
if (unlikely(r->reloc_bo_index > req->nr_buffers)) {
615+
if (unlikely(r->reloc_bo_index >= req->nr_buffers)) {
616616
NV_PRINTK(err, cli, "reloc container bo index invalid\n");
617617
ret = -EINVAL;
618618
break;

0 commit comments

Comments
 (0)