mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
misc: genwqe: check for error from get_user_pages_fast()
`genwqe_user_vmap()` calls `get_user_pages_fast()` and if the return value is less than the number of pages requested, it frees the pages and returns an error (`-EFAULT`). However, it fails to consider a negative error return value from `get_user_pages_fast()`. In that case, the test `if (rc < m->nr_pages)` will be false (due to promotion of `rc` to a large `unsigned int`) and the code will continue on to call `genwqe_map_pages()` with an invalid list of page pointers. Fix it by bailing out if `get_user_pages_fast()` returns a negative error value. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: <stable@vger.kernel.org> # 3.14.x # 3.15.x # 3.16.x # 3.17.x Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
965ab29ba0
commit
cf35d6e047
1 changed files with 2 additions and 0 deletions
|
@ -590,6 +590,8 @@ int genwqe_user_vmap(struct genwqe_dev *cd, struct dma_mapping *m, void *uaddr,
|
||||||
m->nr_pages,
|
m->nr_pages,
|
||||||
1, /* write by caller */
|
1, /* write by caller */
|
||||||
m->page_list); /* ptrs to pages */
|
m->page_list); /* ptrs to pages */
|
||||||
|
if (rc < 0)
|
||||||
|
goto fail_get_user_pages;
|
||||||
|
|
||||||
/* assumption: get_user_pages can be killed by signals. */
|
/* assumption: get_user_pages can be killed by signals. */
|
||||||
if (rc < m->nr_pages) {
|
if (rc < m->nr_pages) {
|
||||||
|
|
Loading…
Reference in a new issue