]> www.infradead.org Git - users/hch/block.git/commit
block: initialize integrity buffer to zero before writing it to media
authorChristoph Hellwig <hch@lst.de>
Thu, 6 Jun 2024 05:22:05 +0000 (07:22 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 6 Jun 2024 09:34:17 +0000 (11:34 +0200)
commit65dc263c3d49b1eb8fb75f39f6cab84b4509d79f
tree0e22702ac4a57d22bfde7686a04aaed8bb99c5a1
parenta7a98f4da8861f9aeee5cf303b911ba7899ef8c5
block: initialize integrity buffer to zero before writing it to media

Metadata added by bio_integrity_prep is using plain kmalloc, which leads
to random kernel memory being written media.  For PI metadata this is
limited to the app tag that isn't used by kernel generated metadata,
but for non-PI metadata the entire buffer leaks kernel memory.

Fix this by adding the __GFP_ZERO flag to allocations for writes.

Fixes: 7ba1ba12eeef ("block: Block layer data integrity support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
block/bio-integrity.c