Blame SOURCES/0459-disk-lvm-Do-not-allow-a-LV-to-be-it-s-own-segment-s-.patch

80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Daniel Axtens <dja@axtens.net>
80913e
Date: Fri, 22 Jan 2021 14:42:21 +1100
80913e
Subject: [PATCH] disk/lvm: Do not allow a LV to be it's own segment's node's
80913e
 LV
80913e
80913e
This prevents infinite recursion in the diskfilter verification code.
80913e
80913e
Signed-off-by: Daniel Axtens <dja@axtens.net>
80913e
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
80913e
---
80913e
 grub-core/disk/lvm.c | 10 +++++++---
80913e
 1 file changed, 7 insertions(+), 3 deletions(-)
80913e
80913e
diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
b32e65
index 9eda28d85..7e86bb7df 100644
80913e
--- a/grub-core/disk/lvm.c
80913e
+++ b/grub-core/disk/lvm.c
80913e
@@ -840,9 +840,13 @@ error_parsing_metadata:
80913e
 		    }
80913e
 		if (lv1->segments[i].nodes[j].pv == NULL)
80913e
 		  for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
80913e
-		    if (grub_strcmp (lv2->name,
80913e
-				     lv1->segments[i].nodes[j].name) == 0)
80913e
-		      lv1->segments[i].nodes[j].lv = lv2;
80913e
+		    {
80913e
+		      if (lv1 == lv2)
80913e
+		        continue;
80913e
+		      if (grub_strcmp (lv2->name,
80913e
+				       lv1->segments[i].nodes[j].name) == 0)
80913e
+			lv1->segments[i].nodes[j].lv = lv2;
80913e
+		    }
80913e
 	      }
80913e
 	
80913e
       }