efi: Handle deletions and size changes in efivarfs_write_file
authorJeremy Kerr <jeremy.kerr@canonical.com>
Fri, 5 Oct 2012 05:54:56 +0000 (13:54 +0800)
committerMatt Fleming <matt.fleming@intel.com>
Tue, 30 Oct 2012 10:39:17 +0000 (10:39 +0000)
commit0c542edde3cecc99b180a440ae33dcb7f28642ce
tree585dc08504412ff15610f4e716e93b485a4fb2ed
parent5d9db883761ad1bc2245fd3018715549b974203d
efi: Handle deletions and size changes in efivarfs_write_file

A write to an efivarfs file will not always result in a variable of
'count' size after the EFI SetVariable() call. We may have appended to
the existing data (ie, with the EFI_VARIABLE_APPEND_WRITE attribute), or
even have deleted the variable (with an authenticated variable update,
with a zero datasize).

This change re-reads the updated variable from firmware, to check for
size changes and deletions. In the latter case, we need to drop the
dentry.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efivars.c