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

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