Skip to content
Commit 2cdcf648 authored by Kent Overstreet's avatar Kent Overstreet Committed by Greg Kroah-Hartman
Browse files

mm/filemap: fix infinite loop in generic_file_buffered_read()



commit 3644e2d2 upstream.

If iter->count is 0 and iocb->ki_pos is page aligned, this causes
nr_pages to be 0.

Then in generic_file_buffered_read_get_pages() find_get_pages_contig()
returns 0 - because we asked for 0 pages, so we call
generic_file_buffered_read_no_cached_page() which attempts to add a page
to the page cache, which fails with -EEXIST, and then we loop. Oops...

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Reported-by: default avatarJens Axboe <axboe@kernel.dk>
Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSuraj Jitindar Singh <surajjs@amazon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0c5d5f8e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment