mirror of
https://github.com/torvalds/linux.git
synced 2026-09-27 19:42:03 +02:00
iomap: don't free integrity payload that doesn't exist
fs_bio_integrity_alloc might not allocate a bio integrity payload if PI
verification is disabled on the block device. Check for that case before
calling fs_bio_integrity_free in iomap_bio_read_folio_range_sync to
avoid a NULL pointer dereferences.
Make the branch cover the PI verification as well - while
fs_bio_integrity_verify works without an integrity payload, it requires
one to actually do useful work.
Fixes: 0b10a37052 ("iomap: support T10 protection information")
Cc: stable@vger.kernel.org # v7.1
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Link: https://patch.msgid.link/20260804124404.737145-2-hch@lst.de
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
7c7fe554f4
commit
8a8685b32c
|
|
@ -170,7 +170,7 @@ int iomap_bio_read_folio_range_sync(const struct iomap_iter *iter,
|
|||
if (srcmap->flags & IOMAP_F_INTEGRITY)
|
||||
fs_bio_integrity_alloc(&bio);
|
||||
error = submit_bio_wait(&bio);
|
||||
if (srcmap->flags & IOMAP_F_INTEGRITY) {
|
||||
if (bio_integrity(&bio)) {
|
||||
if (!error)
|
||||
error = fs_bio_integrity_verify(&bio, sector, len);
|
||||
fs_bio_integrity_free(&bio);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user