[Devel] [PATCH vz9] dm-qcow2: fix bvec iteration macro that can get into an endless loop
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Mon Sep 2 19:40:31 MSK 2024
qcow2_for_each_bvec tries to advance the bvec with bv_len but
if bv_len is zero it goes into an endless loop.
To fix this check for non zero bv_len, there is already check
for size.
https://virtuozzo.atlassian.net/browse/PSBM-157999
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
drivers/md/dm-qcow2-map.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 53bed6c0a30a..810d76934d64 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -24,8 +24,8 @@
#define qcow2_for_each_bvec(iter, bv, start_iter, from_bv) \
for (iter = start_iter; \
- iter.bi_size && ((bv = mp_bvec_iter_bvec(from_bv, iter)), 1); \
- bvec_iter_advance(from_bv, &iter, bv.bv_len))
+ iter.bi_size && ((bv = mp_bvec_iter_bvec(from_bv, iter)), 1) \
+ && bv.bv_len; bvec_iter_advance(from_bv, &iter, bv.bv_len))
struct qcow2_map_item {
/*
--
2.43.0
More information about the Devel
mailing list