diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-07-01 10:16:08 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-07-01 10:16:08 -0400 |
commit | 5be1f9d82fa73c199ebeee2866dbac83e419c897 (patch) | |
tree | aed1aec34f40b5e0f36dceea8b58d9cfdb41d233 /mm/vmalloc.c | |
parent | ff91064ea37c8323eba31cc3d2e22464f107b50d (diff) | |
parent | 4b972a01a7da614b4796475f933094751a295a2f (diff) |
Merge tag 'v5.2-rc6' into for-5.3/block
Merge 5.2-rc6 into for-5.3/block, so we get the same page merge leak
fix. Otherwise we end up having conflicts with future patches between
for-5.3/block and master that touch this area. In particular, it makes
the bio_full() fix hard to backport to stable.
* tag 'v5.2-rc6': (482 commits)
Linux 5.2-rc6
Revert "iommu/vt-d: Fix lock inversion between iommu->lock and device_domain_lock"
Bluetooth: Fix regression with minimum encryption key size alignment
tcp: refine memory limit test in tcp_fragment()
x86/vdso: Prevent segfaults due to hoisted vclock reads
SUNRPC: Fix a credential refcount leak
Revert "SUNRPC: Declare RPC timers as TIMER_DEFERRABLE"
net :sunrpc :clnt :Fix xps refcount imbalance on the error path
NFS4: Only set creation opendata if O_CREAT
ARM: 8867/1: vdso: pass --be8 to linker if necessary
KVM: nVMX: reorganize initial steps of vmx_set_nested_state
KVM: PPC: Book3S HV: Invalidate ERAT when flushing guest TLB entries
habanalabs: use u64_to_user_ptr() for reading user pointers
nfsd: replace Jeff by Chuck as nfsd co-maintainer
inet: clear num_timeout reqsk_alloc()
PCI/P2PDMA: Ignore root complex whitelist when an IOMMU is present
net: mvpp2: debugfs: Add pmap to fs dump
ipv6: Default fib6_type to RTN_UNICAST when not set
net: hns3: Fix inconsistent indenting
net/af_iucv: always register net_device notifier
...
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 7350a124524b..4c9e150e5ad3 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2123,9 +2123,9 @@ static inline void set_area_direct_map(const struct vm_struct *area, | |||
2123 | /* Handle removing and resetting vm mappings related to the vm_struct. */ | 2123 | /* Handle removing and resetting vm mappings related to the vm_struct. */ |
2124 | static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) | 2124 | static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) |
2125 | { | 2125 | { |
2126 | unsigned long addr = (unsigned long)area->addr; | ||
2127 | unsigned long start = ULONG_MAX, end = 0; | 2126 | unsigned long start = ULONG_MAX, end = 0; |
2128 | int flush_reset = area->flags & VM_FLUSH_RESET_PERMS; | 2127 | int flush_reset = area->flags & VM_FLUSH_RESET_PERMS; |
2128 | int flush_dmap = 0; | ||
2129 | int i; | 2129 | int i; |
2130 | 2130 | ||
2131 | /* | 2131 | /* |
@@ -2135,8 +2135,8 @@ static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) | |||
2135 | * execute permissions, without leaving a RW+X window. | 2135 | * execute permissions, without leaving a RW+X window. |
2136 | */ | 2136 | */ |
2137 | if (flush_reset && !IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) { | 2137 | if (flush_reset && !IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) { |
2138 | set_memory_nx(addr, area->nr_pages); | 2138 | set_memory_nx((unsigned long)area->addr, area->nr_pages); |
2139 | set_memory_rw(addr, area->nr_pages); | 2139 | set_memory_rw((unsigned long)area->addr, area->nr_pages); |
2140 | } | 2140 | } |
2141 | 2141 | ||
2142 | remove_vm_area(area->addr); | 2142 | remove_vm_area(area->addr); |
@@ -2160,9 +2160,11 @@ static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) | |||
2160 | * the vm_unmap_aliases() flush includes the direct map. | 2160 | * the vm_unmap_aliases() flush includes the direct map. |
2161 | */ | 2161 | */ |
2162 | for (i = 0; i < area->nr_pages; i++) { | 2162 | for (i = 0; i < area->nr_pages; i++) { |
2163 | if (page_address(area->pages[i])) { | 2163 | unsigned long addr = (unsigned long)page_address(area->pages[i]); |
2164 | if (addr) { | ||
2164 | start = min(addr, start); | 2165 | start = min(addr, start); |
2165 | end = max(addr, end); | 2166 | end = max(addr + PAGE_SIZE, end); |
2167 | flush_dmap = 1; | ||
2166 | } | 2168 | } |
2167 | } | 2169 | } |
2168 | 2170 | ||
@@ -2172,7 +2174,7 @@ static void vm_remove_mappings(struct vm_struct *area, int deallocate_pages) | |||
2172 | * reset the direct map permissions to the default. | 2174 | * reset the direct map permissions to the default. |
2173 | */ | 2175 | */ |
2174 | set_area_direct_map(area, set_direct_map_invalid_noflush); | 2176 | set_area_direct_map(area, set_direct_map_invalid_noflush); |
2175 | _vm_unmap_aliases(start, end, 1); | 2177 | _vm_unmap_aliases(start, end, flush_dmap); |
2176 | set_area_direct_map(area, set_direct_map_default_noflush); | 2178 | set_area_direct_map(area, set_direct_map_default_noflush); |
2177 | } | 2179 | } |
2178 | 2180 | ||