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 2021-01-21 18:54:29 +11:00 committed by Daniel Kiper
parent 27a79bf38e
commit 2958695c4c

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)