nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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