mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
A couple of low-priority EFI fixes
- prevent the randstruct plugin from re-ordering EFI protocol definitions; - fix a use-after-free in the capsule loader - drop unused variable -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEE+9lifEBpyUIVN1cpw08iOZLZjyQFAmMZw2gACgkQw08iOZLZ jyQ+Rgv/XGT12sS/7sBldWWRdJcz7ix9G/nZQHAK68qahC9WSIIXbmeZDPspdP6C 7WZs9VQ1CizwHbBxX4voKJD2gV8PDF8hjcq+i5YsHPCuW7Rn607gsPBjBUuISuen 8M3Yrr3xj+uBmkTRqTV2/WgkWgmPrzdicXbP6TcWe9ZFPRO4eaKuqVgFzC0Z2W3h 3O4X8tjth25PAmbYcOJ8H9i9GlVBm/al0it+OM4HgyQduPMRPWBUtibitg5QC8P1 rOqeeAeZAt58qRN5Tf5t/sDSARnjyiqm4ruNpL15/cACaur+YFGtu3Y0i/+NCaw/ s8Aqh2z7ljxb8tYgAYtDofNvQe8aY3bOwnI3rJLL4cd5AvEJQF27A545IpPu78YE Zvu7Gs+qk12669dePnggFEYQg9MCRqRN40QWnADXBoT8kn1x0z3Pj1OdyN5AhI8t DqE9bxWqEoh3rDeGMkp5tL0PYJ6SYJ9ldfCnWxOPl1j2g7WP94fRUhMxa2IlqVjx PRv4/gf8 =IHhL -----END PGP SIGNATURE----- Merge tag 'efi-urgent-for-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi Pull EFI fixes from Ard Biesheuvel: "A couple of low-priority EFI fixes: - prevent the randstruct plugin from re-ordering EFI protocol definitions - fix a use-after-free in the capsule loader - drop unused variable" * tag 'efi-urgent-for-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efi: capsule-loader: Fix use-after-free in efi_capsule_write efi/x86: libstub: remove unused variable efi: libstub: Disable struct randomization
This commit is contained in:
commit
f280b9872a
@ -242,29 +242,6 @@ failed:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_capsule_flush - called by file close or file flush
|
||||
* @file: file pointer
|
||||
* @id: not used
|
||||
*
|
||||
* If a capsule is being partially uploaded then calling this function
|
||||
* will be treated as upload termination and will free those completed
|
||||
* buffer pages and -ECANCELED will be returned.
|
||||
**/
|
||||
static int efi_capsule_flush(struct file *file, fl_owner_t id)
|
||||
{
|
||||
int ret = 0;
|
||||
struct capsule_info *cap_info = file->private_data;
|
||||
|
||||
if (cap_info->index > 0) {
|
||||
pr_err("capsule upload not complete\n");
|
||||
efi_free_all_buff_pages(cap_info);
|
||||
ret = -ECANCELED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_capsule_release - called by file close
|
||||
* @inode: not used
|
||||
@ -277,6 +254,13 @@ static int efi_capsule_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct capsule_info *cap_info = file->private_data;
|
||||
|
||||
if (cap_info->index > 0 &&
|
||||
(cap_info->header.headersize == 0 ||
|
||||
cap_info->count < cap_info->total_size)) {
|
||||
pr_err("capsule upload not complete\n");
|
||||
efi_free_all_buff_pages(cap_info);
|
||||
}
|
||||
|
||||
kfree(cap_info->pages);
|
||||
kfree(cap_info->phys);
|
||||
kfree(file->private_data);
|
||||
@ -324,7 +308,6 @@ static const struct file_operations efi_capsule_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = efi_capsule_open,
|
||||
.write = efi_capsule_write,
|
||||
.flush = efi_capsule_flush,
|
||||
.release = efi_capsule_release,
|
||||
.llseek = no_llseek,
|
||||
};
|
||||
|
@ -37,6 +37,13 @@ KBUILD_CFLAGS := $(cflags-y) -Os -DDISABLE_BRANCH_PROFILING \
|
||||
$(call cc-option,-fno-addrsig) \
|
||||
-D__DISABLE_EXPORTS
|
||||
|
||||
#
|
||||
# struct randomization only makes sense for Linux internal types, which the EFI
|
||||
# stub code never touches, so let's turn off struct randomization for the stub
|
||||
# altogether
|
||||
#
|
||||
KBUILD_CFLAGS := $(filter-out $(RANDSTRUCT_CFLAGS), $(KBUILD_CFLAGS))
|
||||
|
||||
# remove SCS flags from all objects in this directory
|
||||
KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
|
||||
# disable LTO
|
||||
|
@ -220,7 +220,6 @@ adjust_memory_range_protection(unsigned long start, unsigned long size)
|
||||
unsigned long end, next;
|
||||
unsigned long rounded_start, rounded_end;
|
||||
unsigned long unprotect_start, unprotect_size;
|
||||
int has_system_memory = 0;
|
||||
|
||||
if (efi_dxe_table == NULL)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user