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.atana...@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

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to