From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Ming Lei <ming.lei@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
linux-xfs@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH V2 0/2] block: fix page leak by merging to same page
Date: Mon, 10 Jun 2019 12:18:17 +0800 [thread overview]
Message-ID: <20190610041819.11575-1-ming.lei@redhat.com> (raw)
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 <david@gibson.dropbear.id.au>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
--
2.20.1
next reply other threads:[~2019-06-10 4:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 4:18 Ming Lei [this message]
2019-06-10 4:18 ` [PATCH V2 1/2] block: introduce 'enum bvec_merge_flags' for __bio_try_merge_page Ming Lei
2019-06-10 4:18 ` [PATCH V2 2/2] block: fix page leak in case of merging to same page Ming Lei
2019-06-10 8:37 ` [PATCH V2 0/2] block: fix page leak by " Ming Lei
2019-06-10 13:34 ` Christoph Hellwig
2019-06-10 15:09 ` Ming Lei
2019-06-11 7:45 ` Christoph Hellwig
2019-06-11 7:57 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610041819.11575-1-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=darrick.wong@oracle.com \
--cc=david@gibson.dropbear.id.au \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).