Skip to content
Commit 7bed6f3d authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Jens Axboe
Browse files

block: Fix iterating over an empty bio with bio_for_each_folio_all



If the bio contains no data, bio_first_folio() calls page_folio() on a
NULL pointer and oopses.  Move the test that we've reached the end of
the bio from bio_next_folio() to bio_first_folio().

Reported-by: default avatar <syzbot+8b23309d5788a79d3eea@syzkaller.appspotmail.com>
Reported-by: default avatar <syzbot+004c1e0fced2b4bc3dcc@syzkaller.appspotmail.com>
Fixes: 640d1930 ("block: Add bio_for_each_folio_all()")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20240116212959.3413014-1-willy@infradead.org


[axboe: add unlikely() to error case]
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent be50df31
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