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.

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 <>
Reviewed-by: Chaitanya Kulkarni <>
Reviewed-by: Christoph Hellwig <>
Signed-off-by: Jens Axboe <>
[nobelbarakat: Backported to 5.4: Manually added __GFP_ZERO flag]
Signed-off-by: Nobel Barakat <>
Signed-off-by: Greg Kroah-Hartman <
cos-patch: security-moderate
Change-Id: Ic599bb282a98929fbc994a7d8ad0404cddb81f70
Reviewed-by: Meena Shanmugam <>
Tested-by: Cusky Presubmit Bot <>
1 file changed