missing check in __get_user_pages
coverity flagged this code in __get_user_pages
448 if (is_vm_hugetlb_page(vma)) {
449 i = follow_hugetlb_page(mm, vma, pages, vmas,
450 &start, &nr_pages, i,
451 gup_flags);
452 continue;
453 }
It seems unaware that follow_hugetlb_page can in some cases return -EFAULT. I'm not sure if this is triggerable, but it looks dangerous.
Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Dave Jones
coverity flagged this code in
__get_user_pages448 if (
is_vm_hugetlb_page(vma)) {
449 i = follow_hugetlb_page(mm, vma, pages, vmas,
450 &start,&nr_pages, i,
451gup_flags);
452 continue;
453 }It seems unaware that
follow_hugetlb_pagecan in some cases return-EFAULT. I'm not sure if this is triggerable, but it looks dangerous.
Looks like follow_hugetlb_page() sets nr_pages to 0 in this case, and __get_user_pages() can handle this correctly.
But, yes, it's ugly.
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>