Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[linux-2.6-block.git] / mm / vmalloc.c
index 4c9e150e5ad3d26356666457e2d9fb97f807c0a1..030a544e66020fb6af8b0719b551c5848a55aead 100644 (file)
@@ -913,7 +913,7 @@ adjust_va_to_fit_type(struct vmap_area *va,
        unsigned long nva_start_addr, unsigned long size,
        enum fit_type type)
 {
-       struct vmap_area *lva;
+       struct vmap_area *lva = NULL;
 
        if (type == FL_FIT_TYPE) {
                /*
@@ -972,7 +972,7 @@ adjust_va_to_fit_type(struct vmap_area *va,
        if (type != FL_FIT_TYPE) {
                augment_tree_propagate_from(va);
 
-               if (type == NE_FIT_TYPE)
+               if (lva)        /* type == NE_FIT_TYPE */
                        insert_vmap_area_augment(lva, &va->rb_node,
                                &free_vmap_area_root, &free_vmap_area_list);
        }
@@ -2128,17 +2128,6 @@ static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages)
        int flush_dmap = 0;
        int i;
 
-       /*
-        * The below block can be removed when all architectures that have
-        * direct map permissions also have set_direct_map_() implementations.
-        * This is concerned with resetting the direct map any an vm alias with
-        * execute permissions, without leaving a RW+X window.
-        */
-       if (flush_reset && !IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) {
-               set_memory_nx((unsigned long)area->addr, area->nr_pages);
-               set_memory_rw((unsigned long)area->addr, area->nr_pages);
-       }
-
        remove_vm_area(area->addr);
 
        /* If this is not VM_FLUSH_RESET_PERMS memory, no need for the below. */