mirror of
https://github.com/torvalds/linux.git
synced 2026-09-27 11:02:03 +02:00
platform/x86/amd/hsmp: Validate _DSD mailbox sub-package element count
hsmp_read_acpi_dsd() dereferenced elements[0] and elements[1] of each mailbox sub-package before confirming the package actually held two elements, allowing an out-of-bounds read on a malformed _DSD. Verify package.count >= 2 first, then fetch the string and integer objects. Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://patch.msgid.link/20260625123337.886435-3-muralidhara.mk@amd.com Link: https://patch.msgid.link/20260629155634.1807598-3-muralidhara.mk@amd.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
4c7d1b4cd7
commit
0d7a266449
|
|
@ -151,12 +151,18 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
|
|||
union acpi_object *msgobj, *msgstr, *msgint;
|
||||
|
||||
msgobj = &mailbox_package->package.elements[j];
|
||||
msgstr = &msgobj->package.elements[0];
|
||||
msgint = &msgobj->package.elements[1];
|
||||
|
||||
/* package should have 1 string and 1 integer object */
|
||||
if (msgobj->type != ACPI_TYPE_PACKAGE ||
|
||||
msgstr->type != ACPI_TYPE_STRING ||
|
||||
msgobj->package.count < 2) {
|
||||
ret = -EINVAL;
|
||||
goto free_buf;
|
||||
}
|
||||
|
||||
msgstr = &msgobj->package.elements[0];
|
||||
msgint = &msgobj->package.elements[1];
|
||||
|
||||
if (msgstr->type != ACPI_TYPE_STRING ||
|
||||
msgint->type != ACPI_TYPE_INTEGER) {
|
||||
ret = -EINVAL;
|
||||
goto free_buf;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user