From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Kanchan Joshi <joshi.k@samsung.com>,
Anuj Gupta <anuj20.g@samsung.com>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 3/4] block: handle nogenerate/noverify properly in fs-integrity
Date: Fri, 24 Jul 2026 07:09:43 +0200 [thread overview]
Message-ID: <20260724051001.202741-4-hch@lst.de> (raw)
In-Reply-To: <20260724051001.202741-1-hch@lst.de>
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: 0bde8a12b554 ("block: add fs_bio_integrity helpers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
---
block/bio-integrity-fs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/bio-integrity-fs.c b/block/bio-integrity-fs.c
index 9c5fe5fa8f0d..692403dfa047 100644
--- a/block/bio-integrity-fs.c
+++ b/block/bio-integrity-fs.c
@@ -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.
*
--
2.53.0
next prev parent reply other threads:[~2026-07-24 5:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 5:09 fix fs-integrity for non-PI metadata v2 Christoph Hellwig
2026-07-24 5:09 ` [PATCH 1/4] block: remove bip_should_check Christoph Hellwig
2026-07-24 12:22 ` Kanchan Joshi
2026-07-24 5:09 ` [PATCH 2/4] block: lift BIP_CHECK_FLAGS to include/linux/bio-integrity.h Christoph Hellwig
2026-07-24 12:22 ` Kanchan Joshi
2026-07-24 5:09 ` Christoph Hellwig [this message]
2026-07-24 12:24 ` [PATCH 3/4] block: handle nogenerate/noverify properly in fs-integrity Kanchan Joshi
2026-07-24 5:09 ` [PATCH 4/4] iomap: don't free integrity payload that doesn't exist Christoph Hellwig
2026-07-24 12:29 ` Kanchan Joshi
2026-07-24 13:33 ` Anuj gupta
2026-07-24 13:48 ` Martin K. Petersen
2026-07-24 13:47 ` fix fs-integrity for non-PI metadata v2 Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2026-07-21 7:17 fix fs-integrity for non-PI metadata Christoph Hellwig
2026-07-21 7:17 ` [PATCH 3/4] block: handle nogenerate/noverify properly in fs-integrity Christoph Hellwig
2026-07-22 13:59 ` Anuj gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724051001.202741-4-hch@lst.de \
--to=hch@lst.de \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=joshi.k@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox