From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] efi: apple-properties: validate setup data header length
Date: Mon, 6 Jul 2026 17:18:13 +0800 [thread overview]
Message-ID: <20260706091813.77792-1-pengpeng@iscas.ac.cn> (raw)
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
next reply other threads:[~2026-07-06 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 9:18 Pengpeng Hou [this message]
2026-07-06 12:29 ` Lukas Wunner
2026-08-01 13:02 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260706091813.77792-1-pengpeng@iscas.ac.cn \
--to=pengpeng@iscas.ac.cn \
--cc=ardb@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®