[c,b,x][PATCH 2/3] block: Clear kernel memory before copying to user

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


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

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

If the kernel allocates a bounce buffer for user read data, this memory
needs to be cleared before copying it to the user, otherwise it may leak
kernel memory to user space.

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 f3587d76da05f68098ddb1cb3c98cc6a9e8a402c)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

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




More information about the kernel-team mailing list