[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220729194532.228403-3-gpiccoli@igalia.com>
Date: Fri, 29 Jul 2022 16:45:31 -0300
From: "Guilherme G. Piccoli" <gpiccoli@...lia.com>
To: ardb@...nel.org, linux-efi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
kernel@...ccoli.net, anton@...msg.org, ccross@...roid.com,
keescook@...omium.org, matt@...eblueprint.co.uk,
mjg59@...f.ucam.org, tony.luck@...el.com,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>
Subject: [PATCH v2 2/3] 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 letting the
reboot handler to proceed, in case this tentative allocation fails.
Fixes: 416581e48679 ("efi: efibc: avoid efivar API for setting variables")
Signed-off-by: Guilherme G. Piccoli <gpiccoli@...lia.com>
---
Notice the sha-1 hash of the efibc patch we're fixing is from efi/next,
might change in upstream once such patch is merged.
Feel free to remove the fixes tag if it makes sense, no issues from me =)
drivers/firmware/efi/efibc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/firmware/efi/efibc.c b/drivers/firmware/efi/efibc.c
index 7e3bf60d24e0..9a8d914f91a6 100644
--- a/drivers/firmware/efi/efibc.c
+++ b/drivers/firmware/efi/efibc.c
@@ -48,6 +48,8 @@ static int efibc_reboot_notifier_call(struct notifier_block *notifier,
return NOTIFY_DONE;
wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL);
+ if (!wdata)
+ return NOTIFY_DONE;
len = efi_str8_to_str16(wdata, str, MAX_DATA_LEN - 1);
--
2.37.1
Powered by blists - more mailing lists