Skip to contentSkip to conversation

Patch "efi: Do variable name validation tests in utf8" has been added to the 3.10-stable tree

PATCH [email protected] 1 participant 1 message Mar 13, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

efi: Do variable name validation tests in utf8

to the 3.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
efi-do-variable-name-validation-tests-in-utf8.patch
and it can be found in the queue-3.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 3dcb1f55dfc7631695e69df4a0d589ce5274bd07 Mon Sep 17 00:00:00 2001

From: Peter Jones <[email protected]>
Date: Mon, 8 Feb 2016 14:48:13 -0500
Subject: efi: Do variable name validation tests in utf8

From: Peter Jones <[email protected]>

commit 3dcb1f55dfc7631695e69df4a0d589ce5274bd07 upstream.

Actually translate from ucs2 to utf8 before doing the test, and then test against our other utf8 data, instead of fudging it.

---
 drivers/firmware/efi/efivars.c |    4 +-
 drivers/firmware/efi/vars.c    |   58 ++++++++++++++++++++++++-----------------
 include/linux/efi.h            |    6 ++--
 3 files changed, 40 insertions(+), 28 deletions(-)
drivers/firmware/efi/efivars.c +2 -2
@@ -219,7 +219,7 @@ efivar_store_raw(struct efivar_entry *en
 	}
 
 	if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
-	    efivar_validate(new_var, new_var->Data, new_var->DataSize) == false) {
+	    efivar_validate(new_var->VariableName, new_var->Data, new_var->DataSize) == false) {
 		printk(KERN_ERR "efivars: Malformed variable content\n");
 		return -EINVAL;
 	}
@@ -334,7 +334,7 @@ static ssize_t efivar_create(struct file
 		return -EACCES;
 
 	if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
-	    efivar_validate(new_var, new_var->Data, new_var->DataSize) == false) {
+	    efivar_validate(new_var->VariableName, new_var->Data, new_var->DataSize) == false) {
 		printk(KERN_ERR "efivars: Malformed variable content\n");
 		return -EINVAL;
 	}
drivers/firmware/efi/vars.c +34 -24

137 lines not on this page · raw message

include/linux/efi.h +4 -2
@@ -769,8 +769,10 @@ struct efivars {
  * and we use a page for reading/writing.
  */
 
+#define EFI_VAR_NAME_LEN	1024
+
 struct efi_variable {
-	efi_char16_t  VariableName[1024/sizeof(efi_char16_t)];
+	efi_char16_t  VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
 	efi_guid_t    VendorGuid;
 	unsigned long DataSize;
 	__u8          Data[1024];
@@ -832,7 +834,7 @@ int efivar_entry_iter(int (*func)(struct
 struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
 				       struct list_head *head, bool remove);
 
-bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len);
+bool efivar_validate(efi_char16_t *var_name, u8 *data, unsigned long len);
 
 extern struct work_struct efivar_work;
 void efivar_run_worker(void);

Patches currently in stable-queue which might be from [email protected] are

queue-3.10/lib-ucs2_string-add-ucs2-utf8-helper-functions.patch queue-3.10/lib-ucs2_string-correct-ucs2-utf8-conversion.patch queue-3.10/efi-do-variable-name-validation-tests-in-utf8.patch queue-3.10/efi-make-efivarfs-entries-immutable-by-default.patch queue-3.10/efi-add-pstore-variables-to-the-deletion-whitelist.patch queue-3.10/efi-make-our-variable-validation-list-include-the-guid.patch queue-3.10/efi-use-ucs2_as_utf8-in-efivarfs-instead-of-open-coding-a-bad-version.patch