]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Oct 2019 13:55:20 +0000 (14:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Oct 2019 13:55:20 +0000 (14:55 +0100)
added patches:
parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch

queue-4.14/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch [new file with mode: 0644]
queue-4.14/series

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 (file)
index 0000000..eb27419
--- /dev/null
@@ -0,0 +1,60 @@
+From 513f7f747e1cba81f28a436911fba0b485878ebd Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Fri, 4 Oct 2019 19:23:37 +0200
+Subject: parisc: Fix vmap memory leak in ioremap()/iounmap()
+
+From: Helge Deller <deller@gmx.de>
+
+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=<size> to increase size
+
+It seems we missed calling vunmap() in iounmap().
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Noticed-by: Sven Schnelle <svens@stackframe.org>
+Cc: <stable@vger.kernel.org> # v3.16+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 <deller@gmx.de>
++ * (C) Copyright 2001-2019 Helge Deller <deller@gmx.de>
+  * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
+  */
+@@ -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);
index c046c81595639cccc9d620d2bfb23ff1f6565205..1e40ebf7eb240747157863fb72035f52a8b72ee5 100644 (file)
@@ -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