iommu/amd: bound early ACPI HID map entries
Subsystems (2)
PATCH 1/1 iommu/amd: bound early ACPI HID map entries
parse_ivrs_acpihid() appends command-line ACPI HID mappings to the fixed early_acpihid_map[] array, but unlike the neighbouring IOAPIC and HPET parsers it does not check early_acpihid_map_size before incrementing it and writing the next entry.
Reject additional ivrs_acpihid= entries once the fixed early map is full.
--- drivers/iommu/amd/init.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/iommu/amd/init.c +5 -0
@@ -3888,6 +3888,11 @@return 1 ; } +if (early_acpihid_map_size ==EARLY_MAP_SIZE ) { +pr_err ("Invalid command line: too many ivrs_acpihid entries\n" ); +return 1 ; + } + i = early_acpihid_map_size++;memcpy (early_acpihid_map[i].hid, hid,strlen (hid));memcpy (early_acpihid_map[i].uid, uid,strlen (uid));
Quoted 16 lines · Pengpeng Hou
parse_ivrs_acpihid()appends command-line ACPI HID mappings to the fixed early_acpihid_map[] array, but unlike the neighbouring IOAPIC and HPET parsers it does not checkearly_acpihid_map_sizebefore incrementing it and writing the next entry.Reject additional ivrs_acpihid= entries once the fixed early map is full.
Signed-off-by Pengpeng Hou <[email protected]>--- drivers/iommu/amd/init.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/iommu/amd/init.c line 3892
Quoted 5 lines
drivers/iommu/amd/init.c +2
-0@@ -3888,6 +3888,11 @@return 1 ; } +if (early_acpihid_map_size ==EARLY_MAP_SIZE ) { +pr_err ("Invalid command line: too many ivrs_acpihid entries\n" );
Hi,
This is not invalid option, the entry may be valid but there is no room to add it. It should be something like
pr_err("Early IOAPIC map overflow - ignoring ivrs_ioapic%s\n", str);
and this check should be first thing under 'found' lable, before parsing hid and uid.
-Ankit
Quoted 7 lines
drivers/iommu/amd/init.c +3
-0+return 1 ; + } + i = early_acpihid_map_size++;memcpy (early_acpihid_map[i].hid, hid,strlen (hid));memcpy (early_acpihid_map[i].uid, uid,strlen (uid));