From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Keith Busch , Jens Axboe , Sasha Levin , linux-block@vger.kernel.org Subject: [PATCH AUTOSEL 4.18 32/59] block: Clear kernel memory before copying to user Date: Wed, 14 Nov 2018 17:23:04 -0500 Message-Id: <20181114222335.99339-32-sashal@kernel.org> In-Reply-To: <20181114222335.99339-1-sashal@kernel.org> References: <20181114222335.99339-1-sashal@kernel.org> List-ID: From: Keith Busch [ Upstream commit f3587d76da05f68098ddb1cb3c98cc6a9e8a402c ] 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 Signed-off-by: Keith Busch Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio.c b/block/bio.c index ff94640bc734..5ad106e765fc 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1336,6 +1336,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.17.1