]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: fix leak un ioremap_page_range() failure
authorIngo Molnar <mingo@elte.hu>
Thu, 28 Feb 2008 13:02:08 +0000 (14:02 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 29 Feb 2008 17:55:42 +0000 (18:55 +0100)
Jan Beulich noticed it during code review that if a driver's ioremap()
fails (say due to -ENOMEM) then we might leak the struct vm_area.

Free it properly.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/ioremap.c

index 882328efc3dbab30920cfa041892f1e877be9a50..ac3c959e271d2e6e4f16875f0c20b6f792bb8c88 100644 (file)
@@ -162,7 +162,7 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
        area->phys_addr = phys_addr;
        vaddr = (unsigned long) area->addr;
        if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) {
-               remove_vm_area((void *)(vaddr & PAGE_MASK));
+               free_vm_area(area);
                return NULL;
        }