Pull request for UEFI sub-system for efi-2021-01-rc3 (3)

The following errors are corrected:

* Linux crash when accessing UEFI variables at runtime.
* UEFI variable using standalone MM on 32 bit systems
  not working due to missing packing of communication
  structure
* NULL dereference when FAT16 root directory is full
* FAT files with a short file name starting with 0xE5 (0x05 in directory
  entry) where treated as deleted.

The UEFI SetTime() service is enabled on ARM QEMU.
This commit is contained in:
Tom Rini
2020-11-29 11:12:49 -05:00
5 changed files with 9 additions and 8 deletions

View File

@@ -926,8 +926,7 @@ static int fat_itr_next(fat_itr *itr)
if (!dent)
return 0;
if (dent->name[0] == DELETED_FLAG ||
dent->name[0] == aRING)
if (dent->name[0] == DELETED_FLAG)
continue;
if (dent->attr & ATTR_VOLUME) {

View File

@@ -260,9 +260,8 @@ fill_dir_slot(fat_itr *itr, const char *l_name)
flush_dir(itr);
/* allocate a cluster for more entries */
if (!fat_itr_next(itr))
if (!itr->dent &&
(!itr->is_root || itr->fsdata->fatsize == 32) &&
if (!fat_itr_next(itr) && !itr->dent)
if ((itr->is_root && itr->fsdata->fatsize != 32) ||
new_dir_table(itr))
return -1;
}
@@ -1192,7 +1191,8 @@ int file_fat_write_at(const char *filename, loff_t pos, void *buffer,
}
/* Set short name entry */
fill_dentry(itr->fsdata, itr->dent, filename, 0, size, 0x20);
fill_dentry(itr->fsdata, itr->dent, filename, 0, size,
ATTR_ARCH);
retdent = itr->dent;
}

View File

@@ -43,7 +43,7 @@
* To avoid confusion in interpreting frames, the communication buffer should
* always begin with efi_mm_communicate_header.
*/
struct efi_mm_communicate_header {
struct __packed efi_mm_communicate_header {
efi_guid_t header_guid;
size_t message_len;
u8 data[];

View File

@@ -8,6 +8,7 @@
#include <common.h>
#include <charset.h>
#include <capitalization.h>
#include <efi_loader.h>
#include <malloc.h>
static struct capitalization_table capitalization_table[] =
@@ -372,7 +373,7 @@ size_t u16_strlen(const void *in)
return ret;
}
size_t u16_strnlen(const u16 *in, size_t count)
size_t __efi_runtime u16_strnlen(const u16 *in, size_t count)
{
size_t i;
for (i = 0; count-- && in[i]; i++);

View File

@@ -88,6 +88,7 @@ config EFI_GET_TIME
config EFI_SET_TIME
bool "SetTime() runtime service"
depends on EFI_GET_TIME
default y if ARCH_QEMU || SANDBOX
default n
help
Provide the SetTime() runtime service at boottime. This service