nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0417-disk-lvm-Bail-on-missing-PV-list.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Daniel Axtens <dja@axtens.net>
b1bcb2
Date: Thu, 21 Jan 2021 18:54:29 +1100
b1bcb2
Subject: [PATCH] disk/lvm: Bail on missing PV list
b1bcb2
b1bcb2
There's an if block for the presence of "physical_volumes {", but if
b1bcb2
that block is absent, then p remains NULL and a NULL-deref will result
b1bcb2
when looking for logical volumes.
b1bcb2
b1bcb2
It doesn't seem like LVM makes sense without physical volumes, so error
b1bcb2
out rather than crashing.
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 | 2 ++
b1bcb2
 1 file changed, 2 insertions(+)
b1bcb2
b1bcb2
diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
b1bcb2
index 7a8d61ffb20..939afa17d28 100644
b1bcb2
--- a/grub-core/disk/lvm.c
b1bcb2
+++ b/grub-core/disk/lvm.c
b1bcb2
@@ -371,6 +371,8 @@ error_parsing_metadata:
b1bcb2
 	      goto fail4;
b1bcb2
 	    }
b1bcb2
 	}
b1bcb2
+      else
b1bcb2
+        goto fail4;
b1bcb2
 
b1bcb2
       p = grub_strstr (p, "logical_volumes {");
b1bcb2
       if (p)