Skip to content
Snippets Groups Projects
Commit 95848dcb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

zram: take device and not only bvec offset into account


Commit af8b04c6 ("zram: simplify bvec iteration in
__zram_make_request") changed the bio iteration in zram to rely on the
implicit capping to page boundaries in bio_for_each_segment.  But it
failed to care for the fact zram not only care about the page alignment
of the bio payload, but also the page alignment into the device.  For
buffered I/O and swap those are the same, but for direct I/O or kernel
internal I/O like XFS log buffer writes they can differ.

Fix this by open coding bio_for_each_segment and limiting the bvec len
so that it never crosses over a page alignment boundary in the device
in addition to the payload boundary already taken care of by
bio_iter_iovec.

Cc: stable@vger.kernel.org
Fixes: af8b04c6 ("zram: simplify bvec iteration in __zram_make_request")
Reported-by: default avatarDusty Mabe <dusty@dustymabe.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Link: https://lore.kernel.org/r/20230805055537.147835-1-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a592ab61
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment