Skip to contentSkip to conversation

efi_loader: Fix to set bootdev_root correctly if bootdev found

PATCH In review Masami Hiramatsu 3 participants 4 messages Jul 12, 2021 – Jul 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: Fix to set bootdev_root correctly if bootdev found

Fix find_boot_device() to set bootdev_root if it finds the bootdev from BootNext. Currently it sets the bootdev_root only when it finds bootdev from BootOrder.

Fixes c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
---
 lib/efi_loader/efi_capsule.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +2 -1
index 50bed32bfb..b736f4ef9e 100644
@@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)
 		ret = get_dp_device(boot_var16, &boot_dev);
 		if (ret == EFI_SUCCESS) {
 			if (device_is_present_and_system_part(boot_dev)) {
-				goto out;
+				goto found;
 			} else {
 				efi_free_pool(boot_dev);
 				boot_dev = NULL;
@@ -675,6 +675,7 @@ skip:
 		efi_free_pool(boot_dev);
 		boot_dev = NULL;
 	}
+found:
 	if (boot_dev) {
 		u16 *path_str;
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Masami Hiramatsu

Fix find_boot_device() to set bootdev_root if it finds the bootdev from BootNext. Currently it sets the bootdev_root only when it finds bootdev from BootOrder.

Fixes c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
---
  lib/efi_loader/efi_capsule.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +1 -1
index 50bed32bfb..b736f4ef9e 100644
@@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)
  		ret = get_dp_device(boot_var16, &boot_dev);
  		if (ret == EFI_SUCCESS) {
  			if (device_is_present_and_system_part(boot_dev)) {
-				goto out;
+				goto found;
  			} else {
  				efi_free_pool(boot_dev);
  				boot_dev = NULL;

lib/efi_loader/efi_capsule.c skip: · line 680

Quoted 6 lines
lib/efi_loader/efi_capsule.c +1 -0
@@ -675,6 +675,7 @@ skip:
  		efi_free_pool(boot_dev);
  		boot_dev = NULL;
  	}
+found:
  	if (boot_dev) {
  		u16 *path_str;

The code that follows should be reworked too:

<cite>
u16 *path_str;

path_str = efi_dp_str(boot_dev);
log_debug("Boot device %ls\n", path_str);
efi_free_pool(path_str);
</cite>

Use log-debug("Boot device %pD\n", boot_dev); instead.

But that is work for a separate patch.

Quoted 2 lines
#2 lore raw
Quoted 52 lines · Heinrich Schuchardt
Quoted 24 lines · Masami Hiramatsu

Fix find_boot_device() to set bootdev_root if it finds the bootdev from BootNext. Currently it sets the bootdev_root only when it finds bootdev from BootOrder.

Fixes c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
---
  lib/efi_loader/efi_capsule.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +1 -1
index 50bed32bfb..b736f4ef9e 100644
@@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)
              ret = get_dp_device(boot_var16, &boot_dev);
              if (ret == EFI_SUCCESS) {
                      if (device_is_present_and_system_part(boot_dev)) {
-                             goto out;
+                             goto found;
                      } else {
                              efi_free_pool(boot_dev);
                              boot_dev = NULL;

lib/efi_loader/efi_capsule.c skip: · line 680

Quoted 6 lines
lib/efi_loader/efi_capsule.c +1 -0
@@ -675,6 +675,7 @@ skip:
              efi_free_pool(boot_dev);
              boot_dev = NULL;
      }
+found:
      if (boot_dev) {
              u16 *path_str;

The code that follows should be reworked too:

<cite>
u16 *path_str;

path_str = efi_dp_str(boot_dev);
log_debug("Boot device %ls\n", path_str);
efi_free_pool(path_str);
</cite>

Use log-debug("Boot device %pD\n", boot_dev); instead.

But that is work for a separate patch.

Quoted 2 lines
#3 lore raw
In reply to Heinrich Schuchardt

Hi Heinrich,

2021年7月13日(火) 2:40 Heinrich Schuchardt <[email protected]>:

Quoted 38 lines · Masami Hiramatsu
Quoted 24 lines

Fix find_boot_device() to set bootdev_root if it finds the bootdev from BootNext. Currently it sets the bootdev_root only when it finds bootdev from BootOrder.

Fixes c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
---
  lib/efi_loader/efi_capsule.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/efi_loader/efi_capsule.c +1 -1
index 50bed32bfb..b736f4ef9e 100644
@@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)
              ret = get_dp_device(boot_var16, &boot_dev);
              if (ret == EFI_SUCCESS) {
                      if (device_is_present_and_system_part(boot_dev)) {
-                             goto out;
+                             goto found;
                      } else {
                              efi_free_pool(boot_dev);
                              boot_dev = NULL;

lib/efi_loader/efi_capsule.c skip: · line 680

Quoted 6 lines
lib/efi_loader/efi_capsule.c +1 -0
@@ -675,6 +675,7 @@ skip:
              efi_free_pool(boot_dev);
              boot_dev = NULL;
      }
+found:
      if (boot_dev) {
              u16 *path_str;

The code that follows should be reworked too:

<cite>
u16 *path_str;

Quoted 8 lines

path_str = efi_dp_str(boot_dev);
log_debug("Boot device %ls\n", path_str);
efi_free_pool(path_str);
</cite>

Use log-debug("Boot device %pD\n", boot_dev); instead.

But that is work for a separate patch.

OK, let me fix that.

Quoted 2 lines

Thank you!

Quoted 4 lines
Quoted 3 lines
Signature · 1 line
Masami Hiramatsu