disk/lvm: Bail on missing PV list

There's an if block for the presence of "physical_volumes {", but if
that block is absent, then p remains NULL and a NULL-deref will result
when looking for logical volumes.

It doesn't seem like LVM makes sense without physical volumes, so error
out rather than crashing.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Daniel Axtens authored and Daniel Kiper committed 2021-03-02 15:54:18 +01:00
1 parent 27a79bf38e
commit 2958695c4c
1 file changed
+2
+2
View File
@@ -409,6 +409,8 @@ grub_lvm_detect (grub_disk_t disk,
goto fail4;
}
}
else
goto fail4;
p = grub_strstr (p, "logical_volumes {");
if (p)