nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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