Skip to content

Commit

Permalink
ceph: handle partial result from get_user_pages
Browse files Browse the repository at this point in the history
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 <henry_c_chang@tcloudcomputing.com>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Henry C Chang authored and Sage Weil committed Dec 17, 2010
1 parent b6aa590 commit 361cf40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ceph/pagevec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current->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);
Expand Down

0 comments on commit 361cf40

Please sign in to comment.