mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
ceph: handle partial result from get_user_pages
The get_user_pages() helper can return fewer than the requested pages. Error out in that case, and clean up the partial result. Signed-off-by: Henry C Chang <[email protected]> Signed-off-by: Sage Weil <[email protected]>
This commit is contained in:
parent
b6aa5901c7
commit
361cf40519
1 changed files with 2 additions and 2 deletions
|
|
@ -26,12 +26,12 @@ struct page **ceph_get_direct_page_vector(const char __user *data,
|
|||
rc = get_user_pages(current, current->mm, (unsigned long)data,
|
||||
num_pages, write_page, 0, pages, NULL);
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
if (rc < 0)
|
||||
if (rc < num_pages)
|
||||
goto fail;
|
||||
return pages;
|
||||
|
||||
fail:
|
||||
kfree(pages);
|
||||
ceph_put_page_vector(pages, rc > 0 ? rc : 0, false);
|
||||
return ERR_PTR(rc);
|
||||
}
|
||||
EXPORT_SYMBOL(ceph_get_direct_page_vector);
|
||||
|
|
|
|||
Loading…
Reference in a new issue