From: Greg Kroah-Hartman Date: Sun, 27 Oct 2019 13:55:20 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.4.198~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=017e42697e3b9be85ed62d65b562facfba7e701b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch --- diff --git a/queue-4.14/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch b/queue-4.14/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch new file mode 100644 index 00000000000..eb274191dfb --- /dev/null +++ b/queue-4.14/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch @@ -0,0 +1,60 @@ +From 513f7f747e1cba81f28a436911fba0b485878ebd Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Fri, 4 Oct 2019 19:23:37 +0200 +Subject: parisc: Fix vmap memory leak in ioremap()/iounmap() + +From: Helge Deller + +commit 513f7f747e1cba81f28a436911fba0b485878ebd upstream. + +Sven noticed that calling ioremap() and iounmap() multiple times leads +to a vmap memory leak: + vmap allocation for size 4198400 failed: + use vmalloc= to increase size + +It seems we missed calling vunmap() in iounmap(). + +Signed-off-by: Helge Deller +Noticed-by: Sven Schnelle +Cc: # v3.16+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/mm/ioremap.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/arch/parisc/mm/ioremap.c ++++ b/arch/parisc/mm/ioremap.c +@@ -3,7 +3,7 @@ + * arch/parisc/mm/ioremap.c + * + * (C) Copyright 1995 1996 Linus Torvalds +- * (C) Copyright 2001-2006 Helge Deller ++ * (C) Copyright 2001-2019 Helge Deller + * (C) Copyright 2005 Kyle McMartin + */ + +@@ -84,7 +84,7 @@ void __iomem * __ioremap(unsigned long p + addr = (void __iomem *) area->addr; + if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, + phys_addr, pgprot)) { +- vfree(addr); ++ vunmap(addr); + return NULL; + } + +@@ -92,9 +92,11 @@ void __iomem * __ioremap(unsigned long p + } + EXPORT_SYMBOL(__ioremap); + +-void iounmap(const volatile void __iomem *addr) ++void iounmap(const volatile void __iomem *io_addr) + { +- if (addr > high_memory) +- return vfree((void *) (PAGE_MASK & (unsigned long __force) addr)); ++ unsigned long addr = (unsigned long)io_addr & PAGE_MASK; ++ ++ if (is_vmalloc_addr((void *)addr)) ++ vunmap((void *)addr); + } + EXPORT_SYMBOL(iounmap); diff --git a/queue-4.14/series b/queue-4.14/series index c046c815956..1e40ebf7eb2 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -102,3 +102,4 @@ mm-slub-fix-a-deadlock-in-show_slab_objects.patch mm-page_owner-don-t-access-uninitialized-memmaps-when-reading-proc-pagetypeinfo.patch hugetlbfs-don-t-access-uninitialized-memmaps-in-pfn_range_valid_gigantic.patch xtensa-drop-export_symbol-for-outs-ins.patch +parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch