diff options
author | Keith Busch <kbusch@kernel.org> | 2022-07-12 08:32:56 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-08-02 21:08:54 -0600 |
commit | e97424fd44727b4a5ecb124a49f575fed6086999 (patch) | |
tree | 8cf90aab52270f2e71cb3b961c3c32d51d66ebf1 /block/blk-crypto-internal.h | |
parent | 34cdb8c825f28a5c91c5336a80967533da57da74 (diff) | |
download | linux-e97424fd44727b4a5ecb124a49f575fed6086999.tar.gz linux-e97424fd44727b4a5ecb124a49f575fed6086999.tar.bz2 linux-e97424fd44727b4a5ecb124a49f575fed6086999.zip |
block: fix leaking page ref on truncated direct io
The size being added to a bio from an iov is aligned to a block size
after the pages were gotten. If the new aligned size truncates the last
page, its reference was being leaked. Ensure all pages that were not
added to the bio have their reference released.
Since this essentially requires doing the same that bio_put_pages(), and
there was only one caller for that function, this patch makes the
put_page() loop common for everyone.
Fixes: b1a000d3b8ec5 ("block: relax direct io memory alignment")
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20220712153256.2202024-3-kbusch@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-crypto-internal.h')
0 files changed, 0 insertions, 0 deletions