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

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

diff --git a/queue-4.4/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch b/queue-4.4/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch
new file mode 100644 (file)
index 0000000..611ee77
--- /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
+@@ -2,7 +2,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>
+  */
+@@ -83,7 +83,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;
+       }
+@@ -91,9 +91,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 bd8f1e641c486a785d3fa430b69d36dbeeb0922f..58e6b00a85aa06cf34ee0c9afc5fa9363e5e0a8e 100644 (file)
@@ -30,3 +30,4 @@ drm-edid-add-6-bpc-quirk-for-sdc-panel-in-lenovo-g50.patch
 scsi-zfcp-fix-reaction-on-bit-error-threshold-notifi.patch
 mm-slub-fix-a-deadlock-in-show_slab_objects.patch
 xtensa-drop-export_symbol-for-outs-ins.patch
+parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch