]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
parisc: Fix map_pages() to not overwrite existing pte entries
authorHelge Deller <deller@gmx.de>
Fri, 12 Oct 2018 20:37:46 +0000 (22:37 +0200)
committerHelge Deller <deller@gmx.de>
Wed, 17 Oct 2018 06:18:01 +0000 (08:18 +0200)
Fix a long-existing small nasty bug in the map_pages() implementation which
leads to overwriting already written pte entries with zero, *if* map_pages() is
called a second time with an end address which isn't aligned on a pmd boundry.
This happens for example if we want to remap only the text segment read/write
in order to run alternative patching on the code. Exiting the loop when we
reach the end address fixes this.

Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/mm/init.c

index 74842d28a7a16e9deeda1ff3a38446605805b04a..aae9b0d71c1e1ac5fe30419f7fbab29505c044ec 100644 (file)
@@ -494,12 +494,8 @@ static void __init map_pages(unsigned long start_vaddr,
                                                pte = pte_mkhuge(pte);
                                }
 
-                               if (address >= end_paddr) {
-                                       if (force)
-                                               break;
-                                       else
-                                               pte_val(pte) = 0;
-                               }
+                               if (address >= end_paddr)
+                                       break;
 
                                set_pte(pg_table, pte);