Re: missing check in __get_user_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 10, 2014 at 10:54:39AM -0400, Dave Jones wrote:
> 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.

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.

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]