The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] efi: apple-properties: validate setup data header length
@ 2026-07-06  9:18 Pengpeng Hou
  2026-07-06 12:29 ` Lukas Wunner
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-07-06  9:18 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Pengpeng Hou, Ilias Apalodimas, linux-efi, linux-kernel

map_properties() remaps the Apple properties setup_data payload
and then reads the properties header fields.

Reject a truncated payload before checking the header version and length
fields.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/firmware/efi/apple-properties.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c
index 2e525e17fba7..f401a04edf4c 100644
--- a/drivers/firmware/efi/apple-properties.c
+++ b/drivers/firmware/efi/apple-properties.c
@@ -207,7 +207,10 @@ static int __init map_properties(void)
 		}
 
 		properties = (struct properties_header *)data->data;
-		if (properties->version != 1) {
+		if (data_len < sizeof(*properties)) {
+			pr_err("truncated properties header\n");
+			ret = -EINVAL;
+		} else if (properties->version != 1) {
 			pr_err("unsupported version:\n");
 			print_hex_dump(KERN_ERR, pr_fmt(), DUMP_PREFIX_OFFSET,
 			       16, 1, properties, data_len, true);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-06 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  9:18 [PATCH] efi: apple-properties: validate setup data header length Pengpeng Hou
2026-07-06 12:29 ` Lukas Wunner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox