From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933224AbcHJSMU (ORCPT ); Wed, 10 Aug 2016 14:12:20 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56718 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbcHJSMS (ORCPT ); Wed, 10 Aug 2016 14:12:18 -0400 Date: Wed, 10 Aug 2016 11:11:41 -0700 From: tip-bot for Mike Travis Message-ID: Cc: akpm@linux-foundation.org, rja@sgi.com, mingo@kernel.org, estabrook@sgi.com, linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com, nzimmer@sgi.com, athorlton@sgi.com, abanman@sgi.com, sivanich@sgi.com, tglx@linutronix.de, framsay@sgi.com, travis@sgi.com, torvalds@linux-foundation.org Reply-To: nzimmer@sgi.com, hpa@zytor.com, athorlton@sgi.com, sivanich@sgi.com, abanman@sgi.com, travis@sgi.com, tglx@linutronix.de, framsay@sgi.com, torvalds@linux-foundation.org, rja@sgi.com, akpm@linux-foundation.org, mingo@kernel.org, estabrook@sgi.com, linux-kernel@vger.kernel.org, peterz@infradead.org In-Reply-To: <20160801184050.250424783@asylum.americas.sgi.com> References: <20160801184050.250424783@asylum.americas.sgi.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/platform/UV: Fix bug with iounmap() of the UV4 EFI System Table causing a crash Git-Commit-ID: e363d24c2b997c421476c6aa00547edadf678efe X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e363d24c2b997c421476c6aa00547edadf678efe Gitweb: http://git.kernel.org/tip/e363d24c2b997c421476c6aa00547edadf678efe Author: Mike Travis AuthorDate: Mon, 1 Aug 2016 13:40:51 -0500 Committer: Ingo Molnar 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 Tested-by: John Estabrook Signed-off-by: Mike Travis Reviewed-by: Dimitri Sivanich Reviewed-by: Nathan Zimmer Cc: Alex Thorlton Cc: Andrew Banman Cc: Andrew Morton Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Russ Anderson Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20160801184050.250424783@asylum.americas.sgi.com Signed-off-by: Ingo Molnar --- 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; } }