提交 361cf405 编写于 作者: H Henry C Chang 提交者: Sage Weil

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: NHenry C Chang <henry_c_chang@tcloudcomputing.com>
Signed-off-by: NSage Weil <sage@newdream.net>
上级 b6aa5901
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册