summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2018-11-07 07:37:45 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-27 16:13:05 +0100
commita4da95ea101b2741488c6d84d3ce6e3d0cdffd62 (patch)
tree6407fe53c36a96abd58e52bce90038204c32139a /block
parentb352afaac108d9d6c10cd1d9cd6155b83b779b65 (diff)
downloadlinux-stable-a4da95ea101b2741488c6d84d3ce6e3d0cdffd62.tar.gz
linux-stable-a4da95ea101b2741488c6d84d3ce6e3d0cdffd62.tar.bz2
linux-stable-a4da95ea101b2741488c6d84d3ce6e3d0cdffd62.zip
block: Clear kernel memory before copying to user
[ 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 <loberman@redhat.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c
index 0093bed81c0e..41173710430c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1261,6 +1261,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);
}