efi: be more paranoid about available space when creating variables
authorMatthew Garrett <matthew.garrett@nebula.com>
Sun, 3 Mar 2013 00:40:17 +0000 (19:40 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 18:26:37 +0000 (11:26 -0700)
commit9f677cf27341b7a53915ad0e018912dc022a2a24
tree4d996d8279804e367cb9dda953c9385aa9505acf
parent71727cd9524ab33f702ef47ad32c2c5842c30e39
efi: be more paranoid about available space when creating variables

commit 68d929862e29a8b52a7f2f2f86a0600423b093cd upstream.

UEFI variables are typically stored in flash. For various reasons, avaiable
space is typically not reclaimed immediately upon the deletion of a
variable - instead, the system will garbage collect during initialisation
after a reboot.

Some systems appear to handle this garbage collection extremely poorly,
failing if more than 50% of the system flash is in use. This can result in
the machine refusing to boot. The safest thing to do for the moment is to
forbid writes if they'd end up using more than half of the storage space.
We can make this more finegrained later if we come up with a method for
identifying the broken machines.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efivars.c