Skip to content

Commit

Permalink
drm/vgem: off by one in vgem_gem_fault()
Browse files Browse the repository at this point in the history
If page_offset is == num_pages then we end up reading beyond the end of
obj->pages[].

Fixes: af33a91 ("drm/vgem: Enable dmabuf import interfaces")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703122921.brlfxl4vx2ybvrd2@kili.mountain
  • Loading branch information
Dan Carpenter authored and Daniel Vetter committed Jul 3, 2018
1 parent a1de8d0 commit de10eba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vgem/vgem_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static vm_fault_t vgem_gem_fault(struct vm_fault *vmf)

num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE);

if (page_offset > num_pages)
if (page_offset >= num_pages)
return VM_FAULT_SIGBUS;

mutex_lock(&obj->pages_lock);
Expand Down

0 comments on commit de10eba

Please sign in to comment.