1From 2958695c4cdc785de6ed708709af071a2d20afef Mon Sep 17 00:00:00 2001 2From: Daniel Axtens <dja@axtens.net> 3Date: Thu, 21 Jan 2021 18:54:29 +1100 4Subject: [PATCH] disk/lvm: Bail on missing PV list 5 6There's an if block for the presence of "physical_volumes {", but if 7that block is absent, then p remains NULL and a NULL-deref will result 8when looking for logical volumes. 9 10It doesn't seem like LVM makes sense without physical volumes, so error 11out rather than crashing. 12 13Signed-off-by: Daniel Axtens <dja@axtens.net> 14Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> 15Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> 16--- 17 grub-core/disk/lvm.c | 2 ++ 18 1 file changed, 2 insertions(+) 19 20diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c 21index 36da575..8e560f3 100644 22--- a/grub-core/disk/lvm.c 23+++ b/grub-core/disk/lvm.c 24@@ -370,6 +370,8 @@ grub_lvm_detect (grub_disk_t disk, 25 goto fail4; 26 } 27 } 28+ else 29+ goto fail4; 30 31 p = grub_strstr (p, "logical_volumes {"); 32 if (p) 33-- 342.14.2 35 36