Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3979fdce authored by H. Peter Anvin's avatar H. Peter Anvin
Browse files

Merge tag 'efi-urgent' into x86/urgent



 * Avoid confusing the user by returning -EIO instead of -ENOENT in
   efivarfs if an EFI variable gets deleted from under us and return EOF
   when reading from a zero-length file - Lingzhu Xiang

 * Fix an oops in efivar_update_sysfs_entries() caused by reusing (and
   therefore corrupting) a kzalloc() allocation - Seiji Aguchi

 * Initialise the DataSize argument to GetVariable() otherwise it will
   not be updated with the actual size of the variable on return.
   Discovered on a Acer Aspire V3 BIOS - Lee, Chun-Yi

Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parents fbe06b7b eccaf52f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
	}

	if (boot_used_size && !finished) {
		unsigned long size;
		unsigned long size = 0;
		u32 attr;
		efi_status_t s;
		void *tmp;
+3 −5
Original line number Diff line number Diff line
@@ -523,14 +523,12 @@ static void efivar_update_sysfs_entries(struct work_struct *work)
	struct efivar_entry *entry;
	int err;

	/* Add new sysfs entries */
	while (1) {
		entry = kzalloc(sizeof(*entry), GFP_KERNEL);
		if (!entry)
			return;

	/* Add new sysfs entries */
	while (1) {
		memset(entry, 0, sizeof(*entry));

		err = efivar_init(efivar_update_sysfs_entry, entry,
				  true, false, &efivar_sysfs_list);
		if (!err)
+12 −2
Original line number Diff line number Diff line
@@ -44,8 +44,11 @@ static ssize_t efivarfs_file_write(struct file *file,

	bytes = efivar_entry_set_get_size(var, attributes, &datasize,
					  data, &set);
	if (!set && bytes)
	if (!set && bytes) {
		if (bytes == -ENOENT)
			bytes = -EIO;
		goto out;
	}

	if (bytes == -ENOENT) {
		drop_nlink(inode);
@@ -76,7 +79,14 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
	int err;

	err = efivar_entry_size(var, &datasize);
	if (err)

	/*
	 * efivarfs represents uncommitted variables with
	 * zero-length files. Reading them should return EOF.
	 */
	if (err == -ENOENT)
		return 0;
	else if (err)
		return err;

	data = kmalloc(datasize + sizeof(attributes), GFP_KERNEL);