From: T Makphaibulchoke <tmac@hp.com>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
x86@kernel.org, matt.fleming@intel.com, keithp@keithp.com,
linux-kernel@vger.kernel.org
Cc: T Makphaibulchoke <tmac@hp.com>
Subject: [PATCH] x86/platform/efi/efi_64.c: fix problem in efi_ioremap in case of a failure in init_memory_mapping.
Date: Tue, 11 Sep 2012 17:02:34 -0600 [thread overview]
Message-ID: <1347404554-16975-1-git-send-email-tmac@hp.com> (raw)
In the case that init_memory_mapping failed, returning a NULL, simply return.
An attempt to recursively invoke efi_io_remap could result in mapping of a
wrong range, 0 to size + physaddr, instead of the intended physaddr to
physaddr + size - 1 range.
Signed-off-by: T Makphaibulchoke <tmac@hp.com>
---
arch/x86/platform/efi/efi_64.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index ac3aa54..5d032e9 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -90,6 +90,14 @@ void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
return ioremap(phys_addr, size);
last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size);
+
+ if (!last_map_pfn) {
+ /* Do not try to rmmap again in case of a failure */
+ pr_warn("%s: mapping of 0x%lx(0x%lx) failed.\n",
+ __func__, phys_addr, size);
+ return NULL;
+ }
+
if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) {
unsigned long top = last_map_pfn << PAGE_SHIFT;
efi_ioremap(top, size - (top - phys_addr), type);
--
1.7.1
reply other threads:[~2012-09-11 23:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347404554-16975-1-git-send-email-tmac@hp.com \
--to=tmac@hp.com \
--cc=hpa@zytor.com \
--cc=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®