Hi,
'pages' retrived by __bio_iov_iter_get_pages() may point to same page,
and finally they can be merged to the same page in bio_add_page(), then
page leak can be caused because bio_release_pages() only drops the page
ref once.
Fixes this issue by dropping the extra page ref.
V2:
- V1 breaks multi-page merge, and fix it and only put the page ref
if the added page is really the 'same page'
Ming Lei (2):
block: introduce 'enum bvec_merge_flags' for __bio_try_merge_page
block: fix page leak in case of merging to same page
block/bio.c | 32 ++++++++++++++++++++++----------
fs/iomap.c | 3 ++-
fs/xfs/xfs_aops.c | 3 ++-
include/linux/bio.h | 9 ++++++++-
4 files changed, 34 insertions(+), 13 deletions(-)
Cc: David Gibson <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Cc: [email protected]
Cc: Alexander Viro <[email protected]>
Cc: Christoph Hellwig <[email protected]>
--
2.20.1