]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
disk/lvm: Bail on missing PV list
authorDaniel Axtens <dja@axtens.net>
Thu, 21 Jan 2021 07:54:29 +0000 (18:54 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:18 +0000 (15:54 +0100)
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>
grub-core/disk/lvm.c

index b70d7d79fb7957f9bf454d0fbc3995f2ceb036cd..31bbc9acc97cc89eb6eed96f42098b81c2fa74c8 100644 (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)