From: Mark Bundschuh <mkbund@amazon.com>
To: <stable@vger.kernel.org>
Cc: Mark Bundschuh <mkbund@amazon.com>,
Mikulas Patocka <mpatocka@redhat.com>,
Damien Le Moal <dlemoal@kernel.org>
Subject: [PATCH 5.10.y] dm: fix infinite loop in dm_blk_do_report_zones()
Date: Wed, 25 Nov 2026 21:32:45 +0000 [thread overview]
Message-ID: <20261125213245.1369652-1-mkbund@amazon.com> (raw)
In-Reply-To: <2026112529-pulsate-grass-2146@gregkh>
[ Upstream commit 648320de920b30ae1730bbf0e8b86c0df0fb490a ]
If the device underlying a zoned target is removed, its capacity is set
to 0 and blkdev_report_zones() returns 0 without reporting any zones.
The mapped device keeps its old capacity, so args->zone_idx and
args->next_sector never advance and dm_blk_do_report_zones() loops
forever. On non-preemptible kernels this causes soft lockups and RCU
stalls.
The following sequence of commands triggers the hang:
modprobe scsi_debug zbc=managed dev_size_mb=1024 zone_size_mb=64
udevadm settle
echo '0 2097152 linear /dev/sda 0' | dmsetup create lin
echo 1 > /sys/block/sda/device/delete
blkzone report -o 0 -c 1 /dev/mapper/lin
Fix this by returning -EIO when a target reports no zones. The target
always maps args->next_sector, so a zero return means the underlying
device no longer covers that sector.
Fixes: d41003513e61 ("block: rework zone reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
[ - fdb9aed869f3 ("block: introduce disk_report_zone()") is not
backported because it reworks the zone report API across 16 files of
block and drivers, so the check goes into the local args struct loop
of this branch.
- bb37d77239af ("dm: introduce zone append emulation") is not
backported because it adds zone append emulation and splits out the
report loop, so the -EIO path uses goto out to drop the live table
reference.
- Context differs due to commit: 7fc18728482b ]
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
---
drivers/md/dm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 1a6bf13cea9b..a42b555633cc 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -459,6 +459,10 @@ static int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
nr_zones - args.zone_idx);
if (ret < 0)
goto out;
+ if (!ret) {
+ ret = -EIO;
+ goto out;
+ }
} while (args.zone_idx < nr_zones &&
args.next_sector < get_capacity(disk));
base-commit: 3a323bc22b881a5bdc1646080f93f5ecb22850bf
--
2.50.1
prev parent reply other threads:[~2026-11-25 21:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:18 FAILED: patch "[PATCH] dm: fix infinite loop in dm_blk_do_report_zones()" failed to apply to 5.10-stable tree gregkh
2026-11-25 21:32 ` Mark Bundschuh [this message]
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=20261125213245.1369652-1-mkbund@amazon.com \
--to=mkbund@amazon.com \
--cc=dlemoal@kernel.org \
--cc=mpatocka@redhat.com \
--cc=stable@vger.kernel.org \
/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