From 3e756cc861e5a6c9ed428bb9918b4c5daaf42ee3 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 15 Aug 2026 11:55:46 +0200 Subject: [PATCH] block: warn on too larger integrity allocations 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 Signed-off-by: Jens Axboe --- 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); buf = kmalloc(len, gfp | __GFP_NOWARN | (zero_buffer ? __GFP_ZERO : 0)); if (unlikely(!buf)) { struct page *page;