瀏覽代碼

amd-iommu: make sure only ivmd entries are parsed

The bug never triggered. But it should be fixed to protect against
broken ACPI tables in the future.

[ Impact: protect against broken ivrs acpi table ]

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Joerg Roedel 16 年之前
父節點
當前提交
0bc252f430
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      arch/x86/kernel/amd_iommu_init.c

+ 2 - 0
arch/x86/kernel/amd_iommu_init.c

@@ -906,6 +906,8 @@ static int __init init_unity_map_range(struct ivmd_header *m)
 
 
 	switch (m->type) {
 	switch (m->type) {
 	default:
 	default:
+		kfree(e);
+		return 0;
 	case ACPI_IVMD_TYPE:
 	case ACPI_IVMD_TYPE:
 		e->devid_start = e->devid_end = m->devid;
 		e->devid_start = e->devid_end = m->devid;
 		break;
 		break;