public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: add missing free_memtype if get_vm_area_caller failed
@ 2009-11-04  6:48 Xiaotian Feng
  2009-11-04 10:51 ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Xiaotian Feng @ 2009-11-04  6:48 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, venkatesh.pallipadi, suresh.b.siddha
  Cc: linux-kernel, Xiaotian Feng

When __ioremap_caller goes into get_vm_area, kernel already reserved
memtype. so if get_vm_area fails, we need to free it before return.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/mm/ioremap.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 334e63c..7859f77 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -196,8 +196,10 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
 	 * Ok, go for it..
 	 */
 	area = get_vm_area_caller(size, VM_IOREMAP, caller);
-	if (!area)
+	if (!area) {
+		free_memtype(phys_addr, phys_addr + size);
 		return NULL;
+	}
 	area->phys_addr = phys_addr;
 	vaddr = (unsigned long) area->addr;
 
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-08 11:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04  6:48 [PATCH] x86: add missing free_memtype if get_vm_area_caller failed Xiaotian Feng
2009-11-04 10:51 ` Ingo Molnar
2009-11-05  2:43   ` [PATCH V2] x86: fix error return sequence in __ioremap_caller Xiaotian Feng
2009-11-06  0:23     ` Suresh Siddha
2009-11-08 11:15       ` Ingo Molnar
2009-11-08 11:18     ` [tip:x86/urgent] x86: Fix error return sequence in __ioremap_caller() tip-bot for Xiaotian Feng
2009-11-08 11:51     ` tip-bot for Xiaotian Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox