summaryrefslogtreecommitdiff
path: root/fs/efivarfs/vars.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/efivarfs/vars.c')
-rw-r--r--fs/efivarfs/vars.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/efivarfs/vars.c b/fs/efivarfs/vars.c
index d0beecbf9441..6edc10958ecf 100644
--- a/fs/efivarfs/vars.c
+++ b/fs/efivarfs/vars.c
@@ -364,6 +364,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
* efivar_init - build the initial list of EFI variables
* @func: callback function to invoke for every variable
* @data: function-specific data to pass to @func
+ * @duplicate_check: fail if a duplicate variable is found
*
* Get every EFI variable from the firmware and invoke @func. @func
* should populate the initial dentry and inode tree.
@@ -371,7 +372,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
* Returns 0 on success, or a kernel error code on failure.
*/
int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
- void *data)
+ void *data, bool duplicate_check)
{
unsigned long variable_name_size = 512;
efi_char16_t *variable_name;
@@ -415,7 +416,8 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
* we'll ever see a different variable name,
* and may end up looping here forever.
*/
- if (efivarfs_variable_is_present(variable_name,
+ if (duplicate_check &&
+ efivarfs_variable_is_present(variable_name,
&vendor_guid, data)) {
dup_variable_bug(variable_name, &vendor_guid,
variable_name_size);