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

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