[PATCH 4.19, 4.14, 4.9, 4.4 0/2] efi: fix a race and add a sanity check