[c,b,x][PATCH 3/3] block/bio: Do not zero user pages

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Thu Jun 27 18:16:57 UTC 2019

From: Keith Busch <keith.busch at intel.com>

BugLink: http://bugs.launchpad.net/bugs/1834499

We don't need to zero fill the bio if not using kernel allocated pages.

Fixes: f3587d76da05 ("block: Clear kernel memory before copying to user") # v4.20-rc2
Reported-by: Todd Aiken <taiken at mvtech.ca>
Cc: Laurence Oberman <loberman at redhat.com>
Cc: stable at vger.kernel.org
Cc: Bart Van Assche <bvanassche at acm.org>
Tested-by: Laurence Oberman <loberman at redhat.com>
Signed-off-by: Keith Busch <keith.busch at intel.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
(cherry picked from commit f55adad601c6a97c8c9628195453e0fb23b4a0ae)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
 block/bio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/bio.c b/block/bio.c
index b1d7e1de7b1a..7dfa9acf1482 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1238,7 +1238,8 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
 		if (ret)
 			goto cleanup;
 	} else {
-		zero_fill_bio(bio);
+		if (bmd->is_our_pages)
+			zero_fill_bio(bio);
 		iov_iter_advance(iter, bio->bi_iter.bi_size);

More information about the kernel-team mailing list