b17df973dc
exception of 'efibootmgr-0.6.0-write-unique-id-once.diff', which wasn't "released" yet. OBS-URL: https://build.opensuse.org/package/show/Base:System/efibootmgr?expand=0&rev=12
61 lines
1.9 KiB
Diff
61 lines
1.9 KiB
Diff
From: Raymund Will <rw@suse.com>
|
|
Subject: Fix '--bootorder' handling.
|
|
References: bnc#810899
|
|
|
|
Elisa Mitchell wrote:
|
|
> If efibootmgr -o is called with a boot order number that does not exist
|
|
> in the list you get when you execute efibootmgr, it is supposed to test
|
|
> for an invalid DataSize parameter and exit. In fact, the test conducted
|
|
> will never fail, even on invalid data, and the command will always take
|
|
> the path to make the firmware call, passing FW an invalid DataSize value,
|
|
> which can lead to panics, hangs, uninterruptible command hangs.
|
|
|
|
Even if not every firmware panics over such an "invalid DataSize value",
|
|
it's still a bug, which should be addressed.
|
|
|
|
Reported-by: Elisa Mitchell <lisa.mitchell@hp.com>
|
|
Signed-off-by: Raymund Will <rw@suse.com>
|
|
---
|
|
src/efibootmgr/efibootmgr.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
--- a/src/efibootmgr/efibootmgr.c
|
|
+++ b/src/efibootmgr/efibootmgr.c
|
|
@@ -612,10 +612,10 @@ is_current_boot_entry(int b)
|
|
}
|
|
|
|
|
|
-static int
|
|
+static unsigned long
|
|
parse_boot_order(char *buffer, uint16_t *order, int length)
|
|
{
|
|
- int i;
|
|
+ unsigned long i;
|
|
int num, rc;
|
|
|
|
for (i=0; i<length && *buffer; i++) {
|
|
@@ -623,12 +623,12 @@ parse_boot_order(char *buffer, uint16_t
|
|
if (rc == 1) order[i] = num & 0xFFFF;
|
|
else {
|
|
fprintf(stderr,"\nInvalid hex characters in boot order: %s\n\n",buffer);
|
|
- return -1;
|
|
+ return 0UL;
|
|
}
|
|
/* make sure this is an existing boot entry */
|
|
if (!is_current_boot_entry(order[i])) {
|
|
fprintf (stderr,"\nboot entry %X does not exist\n\n",order[i]);
|
|
- return -1;
|
|
+ return 0UL;
|
|
}
|
|
|
|
/* Advance to the comma */
|
|
@@ -651,7 +651,7 @@ set_boot_order()
|
|
fill_var(&boot_order, "BootOrder");
|
|
|
|
boot_order.DataSize = parse_boot_order(opts.bootorder, n, 1024/sizeof(uint16_t)) * sizeof(uint16_t);
|
|
- if (boot_order.DataSize < 0)
|
|
+ if (boot_order.DataSize == 0UL)
|
|
return 1;
|
|
else
|
|
return create_or_edit_variable(&boot_order);
|