Commit-ID:  e363d24c2b997c421476c6aa00547edadf678efe
Gitweb:     http://git.kernel.org/tip/e363d24c2b997c421476c6aa00547edadf678efe
Author:     Mike Travis <tra...@sgi.com>
AuthorDate: Mon, 1 Aug 2016 13:40:51 -0500
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Wed, 10 Aug 2016 15:55:38 +0200

x86/platform/UV: Fix bug with iounmap() of the UV4 EFI System Table causing a 
crash

Save the uv_systab::size field before doing the iounmap()
of the struct pointer, to avoid a NULL dereference crash.

Tested-by: Frank Ramsay <fram...@sgi.com>
Tested-by: John Estabrook <estabr...@sgi.com>
Signed-off-by: Mike Travis <tra...@sgi.com>
Reviewed-by: Dimitri Sivanich <sivan...@sgi.com>
Reviewed-by: Nathan Zimmer <nzim...@sgi.com>
Cc: Alex Thorlton <athorl...@sgi.com>
Cc: Andrew Banman <aban...@sgi.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Russ Anderson <r...@sgi.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Link: http://lkml.kernel.org/r/20160801184050.250424...@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 arch/x86/platform/uv/bios_uv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
index 66b2166..4e9fd13 100644
--- a/arch/x86/platform/uv/bios_uv.c
+++ b/arch/x86/platform/uv/bios_uv.c
@@ -199,12 +199,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;
                }
        }

Reply via email to