[PATCH 2/2] nvme: drop WARN_ON_ONCE on write_stream bounds check
Hari Mishal <[email protected]> Sat, 25 Jul 2026 15:51:11 +0200
| Newsgroups | org.infradead.lists.linux-nvme,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
write_stream is validated against bdev_max_write_streams() in both generic block direct I/O (block/fops.c) and F2FS before a bio carrying it is ever built, so write_stream > nr_plids shouldn't be reachable through any current legitimate path. The remaining users of bio->bi_write_stream elsewhere in the block layer only copy an already-validated value between bios (bio.c, blk-crypto-fallback.c) or compare it for merge eligibility (blk-merge.c); none of them introduce a new, unvalidated value. Using WARN_ON_ONCE as the backstop for that assumption isn't worth it given how many deployed systems run with panic-on-warn enabled; the existing graceful return BLK_STS_INVAL already handles it on its own. Signed-off-by: Hari Mishal <[email protected]> --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bdc5f07f5bf0..48ae0ffbbe6e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1023,7 +1023,7 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, u16 write_stream = req->bio->bi_write_stream; if (ns->head->nr_plids) { - if (WARN_ON_ONCE(write_stream > ns->head->nr_plids)) + if (write_stream > ns->head->nr_plids) return BLK_STS_INVAL; if (write_stream) { -- 2.43.0