block-map: add __GFP_ZERO flag for alloc_page in function bio_copy_kern

commit cc8f7fe1f5eab010191aa4570f27641876fa1267 upstream.

Add __GFP_ZERO flag for alloc_page in function bio_copy_kern to initialize
the buffer of a bio.

BUG=b/228583025
TEST=cusky
RELEASE_NOTE=This commit fixes CVE-2022-0494 by forcing bio_copy_kern to initialize newly created pages. Creating initialized pages in alloc_page prevents a possible kernel info leak from occuring.

Signed-off-by: Haimin Zhang <tcs.kernel@gmail.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220216084038.15635-1-tcs.kernel@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[nobelbarakat: Backported to 5.4: Manually added __GFP_ZERO flag]
Signed-off-by: Nobel Barakat <nobelbarakat@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cos-patch: security-moderate
Change-Id: Ic599bb282a98929fbc994a7d8ad0404cddb81f70
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/32882
Reviewed-by: Meena Shanmugam <meenashanmugam@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
1 file changed