efi_pstore: Check remaining space with QueryVariableInfo() before writing data
authorSeiji Aguchi <seiji.aguchi@hds.com>
Wed, 14 Nov 2012 20:25:37 +0000 (20:25 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 20 Mar 2013 15:03:27 +0000 (15:03 +0000)
commit316d0bb70f66a2682c19494f2d1fdebfa00de1ac
treeab22d352664c4f4154ea4e4ed383eda89052c993
parent689901ce9cedd2d34a5404dda146d0604cbc2a5e
efi_pstore: Check remaining space with QueryVariableInfo() before writing data

commit d80a361d779a9f19498943d1ca84243209cd5647 upstream.

[Issue]

As discussed in a thread below, Running out of space in EFI isn't a well-tested scenario.
And we wouldn't expect all firmware to handle it gracefully.
http://marc.info/?l=linux-kernel&m=134305325801789&w=2

On the other hand, current efi_pstore doesn't check a remaining space of storage at writing time.
Therefore, efi_pstore may not work if it tries to write a large amount of data.

[Patch Description]

To avoid handling the situation above, this patch checks if there is a space enough to log with
QueryVariableInfo() before writing data.

Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Acked-by: Mike Waychison <mikew@google.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/firmware/efivars.c
include/linux/efi.h