]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/uefi: check access for first variable
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 11 Aug 2025 13:01:09 +0000 (15:01 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 12 Aug 2025 06:03:16 +0000 (08:03 +0200)
When listing variables (via get-next-variable-name) only the names of
variables which can be accessed will be returned.  That check was
missing for the first variable though.  Add it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20250811130110.820958-3-kraxel@redhat.com>

hw/uefi/var-service-vars.c

index cbeccdbd2664328c570beafa1e4070cae84aa895..8533533ea5c8c977fa8c2c49a945da8df5bdd356 100644 (file)
@@ -357,6 +357,9 @@ uefi_vars_mm_get_next_variable(uefi_vars_state *uv, mm_header *mhdr,
     if (uefi_strlen(name, nv->name_size) == 0) {
         /* empty string -> first */
         var = QTAILQ_FIRST(&uv->variables);
+        while (var && !check_access(uv, var)) {
+            var = QTAILQ_NEXT(var, next);
+        }
         if (!var) {
             return uefi_vars_mm_error(mhdr, mvar, EFI_NOT_FOUND);
         }