From 80897c7e5ae5c56f37a2eb004328edcb4da7cdd1 Mon Sep 17 00:00:00 2001 From: Li RongQing Date: Sun, 11 Oct 2026 01:35:55 -0500 Subject: [PATCH] ublk: use global index for reported zones ublk_report_zones() may split a zone report into multiple requests when the number of zones exceeds the temporary buffer capacity. The index passed to disk_report_zone() must refer to the zone position in the whole report, rather than the position within the current request. Currently, the per-request loop index is used as the callback index, causing each chunk after the first one to restart from zero. This can make userspace callbacks receive duplicate zone indices and may result in blk_revalidate_disk_zones() updating incorrect entries in its zone state array. Use the number of zones already reported as the base index for each request so that zone indices remain continuous across all chunks. Fixes: 29802d7ca33b ("ublk: enable zoned storage support") Signed-off-by: Li RongQing Reviewed-by: Ming Lei Tested-by: Ming Lei Signed-off-by: Ming Lei Link: https://patch.msgid.link/20261011063555.1142277-13-tom.leiming@gmail.com Signed-off-by: Jens Axboe --- drivers/block/ublk_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index bc3439c9f43b..dc83e4390e9c 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -696,7 +696,7 @@ static int ublk_report_zones(struct gendisk *disk, sector_t sector, if (!zone->len) break; - ret = disk_report_zone(disk, zone, i, args); + ret = disk_report_zone(disk, zone, done_zones, args); if (ret) goto out;