Skip to content
Commit 3644e2d2 authored by Kent Overstreet's avatar Kent Overstreet Committed by Linus Torvalds
Browse files

mm/filemap: fix infinite loop in generic_file_buffered_read()



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>
parent a0b96314
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment