mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
block: handle nogenerate/noverify properly in fs-integrity
Check the BIP_CHECK flags before generating or verifying PI information,
otherwise this can be incorrectly called for non-PI metadata and
cause generation of incorrect metadata and crashed in the verification
handler.
The new behavior matches that of the block layer auto-generated
metadata.
Fixes: 0bde8a12b5 ("block: add fs_bio_integrity helpers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://patch.msgid.link/20260804123928.736596-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
738f01912a
commit
3bf9a21e7b
|
|
@ -46,7 +46,8 @@ void fs_bio_integrity_free(struct bio *bio)
|
|||
|
||||
void fs_bio_integrity_generate(struct bio *bio)
|
||||
{
|
||||
if (fs_bio_integrity_alloc(bio))
|
||||
if (fs_bio_integrity_alloc(bio) &&
|
||||
(bio_integrity(bio)->bip_flags & BIP_CHECK_FLAGS))
|
||||
bio_integrity_generate(bio);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fs_bio_integrity_generate);
|
||||
|
|
@ -60,6 +61,9 @@ int fs_bio_integrity_verify(struct bio *bio, sector_t sector, unsigned int size)
|
|||
.bi_size = size,
|
||||
};
|
||||
|
||||
if (!bip || !(bip->bip_flags & BIP_CHECK_FLAGS))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Reinitialize bip->bip_iter.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user