mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 15:43:08 -04:00
efi: apple-properties: validate setup data header length
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> Reviewed-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
committed by
Ard Biesheuvel
parent
01787ed2fd
commit
eb01ffabeb
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user