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

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