[PATCH 2/4] x86/platform/UV: Fix problem with iounmap UV4 EFI System Table causing panic

From: Mike Travis
Date: Mon Aug 01 2016 - 15:07:14 EST


Save the size field from the uv_systab struct before doing the iounmap
of the struct pointer, to avoid a null dereference error.

Reviewed-by: Dimitri Sivanich <sivanich@xxxxxxx>
Reviewed-by: Nathan Zimmer <nzimmer@xxxxxxx>
Tested-by: Frank Ramsay <framsay@xxxxxxx>
Tested-by: John Estabrook <estabrook@xxxxxxx>
Signed-off-by: Mike Travis <travis@xxxxxxx>
---
v2: modify description and changelog.
---
arch/x86/platform/uv/bios_uv.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

--- linux.orig/arch/x86/platform/uv/bios_uv.c
+++ linux/arch/x86/platform/uv/bios_uv.c
@@ -200,12 +200,14 @@ void uv_bios_init(void)
return;
}

+ /* Starting with UV4 the UV systab size is variable */
if (uv_systab->revision >= UV_SYSTAB_VERSION_UV4) {
+ int size = uv_systab->size;
+
iounmap(uv_systab);
- uv_systab = ioremap(efi.uv_systab, uv_systab->size);
+ uv_systab = ioremap(efi.uv_systab, size);
if (!uv_systab) {
- pr_err("UV: UVsystab: ioremap(%d) failed!\n",
- uv_systab->size);
+ pr_err("UV: UVsystab: ioremap(%d) failed!\n", size);
return;
}
}

--