Re: [PATCH 02/17] block: warn on too larger integrity allocations

From
Darrick J. Wong <djwong@kernel.org>
Date
2026-08-31 18:01:36
Also in
linux-fsdevel, linux-xfs
Reply to
Christoph Hellwig, 2026-08-31
On Mon, Aug 31, 2026 at 09:39:50AM +0300, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
Catch cases where upper layer bugs create larger I/Os than the
mempool would return even without dipping into the mempool.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio-integrity.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index b23e2434d80c..d3df726e0f08 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -72,6 +72,7 @@ void bio_integrity_alloc_buf(struct bio *bio, gfp_t gfp, bool zero_buffer)
 	unsigned int len = bio_integrity_bytes(bi, bio_sectors(bio));
 	void *buf;
 
+	WARN_ON_ONCE(len > BLK_INTEGRITY_MAX_SIZE);
Should it fail the bio after complaining, then?

--D
 	buf = kmalloc(len, gfp | __GFP_NOWARN | (zero_buffer ? __GFP_ZERO : 0));
 	if (unlikely(!buf)) {
 		struct page *page;
-- 
2.53.0
Thread (33 messages) 33 messages, 3 authors, last reply 2026-09-07
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help