You need to sign in or sign up before continuing.
提交 05b252cc 编写于 作者: G Gerd Hoffmann 提交者: Linus Torvalds

udmabuf: add back sanity check

Check vm_fault->pgoff before using it.  When we removed the warning, we
also removed the check.

Fixes: 7b26e4e2 ("udmabuf: drop WARN_ON() check.")
Reported-by: zdi-disclosures@trendmicro.com
Suggested-by: NLinus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a111daf0
...@@ -32,8 +32,11 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf) ...@@ -32,8 +32,11 @@ static vm_fault_t udmabuf_vm_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct udmabuf *ubuf = vma->vm_private_data; struct udmabuf *ubuf = vma->vm_private_data;
pgoff_t pgoff = vmf->pgoff;
vmf->page = ubuf->pages[vmf->pgoff]; if (pgoff >= ubuf->pagecount)
return VM_FAULT_SIGBUS;
vmf->page = ubuf->pages[pgoff];
get_page(vmf->page); get_page(vmf->page);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册