Skip to content

Commit 7da5b13

Browse files
guilhermepiccoliardbiesheuvel
authored andcommitted
efi: efibc: Guard against allocation failure
There is a single kmalloc in this driver, and it's not currently guarded against allocation failure. Do it here by just bailing-out the reboot handler, in case this tentative allocation fails. Fixes: 416581e ("efi: efibc: avoid efivar API for setting variables") Signed-off-by: Guilherme G. Piccoli <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 9cb636b commit 7da5b13

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/firmware/efi/efibc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ static int efibc_reboot_notifier_call(struct notifier_block *notifier,
4848
return NOTIFY_DONE;
4949

5050
wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL);
51+
if (!wdata)
52+
return NOTIFY_DONE;
53+
5154
for (l = 0; l < MAX_DATA_LEN - 1 && str[l] != '\0'; l++)
5255
wdata[l] = str[l];
5356
wdata[l] = L'\0';

0 commit comments

Comments
 (0)