Skip to content

Commit abe5d79

Browse files
neosys007gregkh
authored andcommitted
iommu/amd: Bound the early ACPI HID map
[ Upstream commit fb80117 ] The ivrs_acpihid command-line parser appends entries to a fixed four-element early_acpihid_map array. Unlike the sibling IOAPIC and HPET parsers, it does not reject a fifth entry before incrementing the map size. Check the capacity at the common found label before parsing the HID and UID or writing the entry. Fixes: ca3bf5d ("iommu/amd: Introduces ivrs_acpihid kernel parameter") Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Reviewed-by: Ankit Soni <Ankit.Soni@amd.com> Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ad26c75 commit abe5d79

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/iommu/amd/init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,12 @@ static int __init parse_ivrs_acpihid(char *str)
36963696
return 1;
36973697

36983698
found:
3699+
if (early_acpihid_map_size == EARLY_MAP_SIZE) {
3700+
pr_err("Early ACPI HID map overflow - ignoring ivrs_acpihid%s\n",
3701+
str);
3702+
return 1;
3703+
}
3704+
36993705
p = acpiid;
37003706
hid = strsep(&p, ":");
37013707
uid = p;

0 commit comments

Comments
 (0)