From: Greg Kroah-Hartman Date: Sun, 27 Oct 2019 13:55:05 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.4.198~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b08c41be61e77f91ed62d095ca1f5923d69b244c;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch --- diff --git a/queue-4.9/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch b/queue-4.9/parisc-fix-vmap-memory-leak-in-ioremap-iounmap.patch new file mode 100644 index 00000000000..611ee77b68a --- /dev/null +++ b/queue-4.9/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 +@@ -2,7 +2,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 + */ + +@@ -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); diff --git a/queue-4.9/series b/queue-4.9/series index 75ae39bb230..62cccec265a 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -38,3 +38,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