diff options
-rw-r--r-- | arch/arm/mm/fault.c | 14 | ||||
-rw-r--r-- | arch/arm64/mm/fault.c | 14 | ||||
-rw-r--r-- | arch/avr32/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/mips/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/trap.c | 2 | ||||
-rw-r--r-- | arch/unicore32/mm/fault.c | 14 |
6 files changed, 26 insertions, 22 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index c97f7940cb95..217bcbfde42e 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -349,6 +349,13 @@ retry: | |||
349 | if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) | 349 | if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) |
350 | return 0; | 350 | return 0; |
351 | 351 | ||
352 | /* | ||
353 | * If we are in kernel mode at this point, we | ||
354 | * have no context to handle this fault with. | ||
355 | */ | ||
356 | if (!user_mode(regs)) | ||
357 | goto no_context; | ||
358 | |||
352 | if (fault & VM_FAULT_OOM) { | 359 | if (fault & VM_FAULT_OOM) { |
353 | /* | 360 | /* |
354 | * We ran out of memory, call the OOM killer, and return to | 361 | * We ran out of memory, call the OOM killer, and return to |
@@ -359,13 +366,6 @@ retry: | |||
359 | return 0; | 366 | return 0; |
360 | } | 367 | } |
361 | 368 | ||
362 | /* | ||
363 | * If we are in kernel mode at this point, we | ||
364 | * have no context to handle this fault with. | ||
365 | */ | ||
366 | if (!user_mode(regs)) | ||
367 | goto no_context; | ||
368 | |||
369 | if (fault & VM_FAULT_SIGBUS) { | 369 | if (fault & VM_FAULT_SIGBUS) { |
370 | /* | 370 | /* |
371 | * We had some memory, but were unable to | 371 | * We had some memory, but were unable to |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 6c8ba25bf6bb..0bb7db41f4fe 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
@@ -288,6 +288,13 @@ retry: | |||
288 | VM_FAULT_BADACCESS)))) | 288 | VM_FAULT_BADACCESS)))) |
289 | return 0; | 289 | return 0; |
290 | 290 | ||
291 | /* | ||
292 | * If we are in kernel mode at this point, we have no context to | ||
293 | * handle this fault with. | ||
294 | */ | ||
295 | if (!user_mode(regs)) | ||
296 | goto no_context; | ||
297 | |||
291 | if (fault & VM_FAULT_OOM) { | 298 | if (fault & VM_FAULT_OOM) { |
292 | /* | 299 | /* |
293 | * We ran out of memory, call the OOM killer, and return to | 300 | * We ran out of memory, call the OOM killer, and return to |
@@ -298,13 +305,6 @@ retry: | |||
298 | return 0; | 305 | return 0; |
299 | } | 306 | } |
300 | 307 | ||
301 | /* | ||
302 | * If we are in kernel mode at this point, we have no context to | ||
303 | * handle this fault with. | ||
304 | */ | ||
305 | if (!user_mode(regs)) | ||
306 | goto no_context; | ||
307 | |||
308 | if (fault & VM_FAULT_SIGBUS) { | 308 | if (fault & VM_FAULT_SIGBUS) { |
309 | /* | 309 | /* |
310 | * We had some memory, but were unable to successfully fix up | 310 | * We had some memory, but were unable to successfully fix up |
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c index b2f2d2d66849..2ca27b055825 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c | |||
@@ -228,9 +228,9 @@ no_context: | |||
228 | */ | 228 | */ |
229 | out_of_memory: | 229 | out_of_memory: |
230 | up_read(&mm->mmap_sem); | 230 | up_read(&mm->mmap_sem); |
231 | pagefault_out_of_memory(); | ||
232 | if (!user_mode(regs)) | 231 | if (!user_mode(regs)) |
233 | goto no_context; | 232 | goto no_context; |
233 | pagefault_out_of_memory(); | ||
234 | return; | 234 | return; |
235 | 235 | ||
236 | do_sigbus: | 236 | do_sigbus: |
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index 85df1cd8d446..94d3a31ab144 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c | |||
@@ -241,6 +241,8 @@ out_of_memory: | |||
241 | * (which will retry the fault, or kill us if we got oom-killed). | 241 | * (which will retry the fault, or kill us if we got oom-killed). |
242 | */ | 242 | */ |
243 | up_read(&mm->mmap_sem); | 243 | up_read(&mm->mmap_sem); |
244 | if (!user_mode(regs)) | ||
245 | goto no_context; | ||
244 | pagefault_out_of_memory(); | 246 | pagefault_out_of_memory(); |
245 | return; | 247 | return; |
246 | 248 | ||
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 089f3987e273..b2f5adf838dd 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -124,6 +124,8 @@ out_of_memory: | |||
124 | * (which will retry the fault, or kill us if we got oom-killed). | 124 | * (which will retry the fault, or kill us if we got oom-killed). |
125 | */ | 125 | */ |
126 | up_read(&mm->mmap_sem); | 126 | up_read(&mm->mmap_sem); |
127 | if (!is_user) | ||
128 | goto out_nosemaphore; | ||
127 | pagefault_out_of_memory(); | 129 | pagefault_out_of_memory(); |
128 | return 0; | 130 | return 0; |
129 | } | 131 | } |
diff --git a/arch/unicore32/mm/fault.c b/arch/unicore32/mm/fault.c index f9b5c10bccee..8ed3c4509d84 100644 --- a/arch/unicore32/mm/fault.c +++ b/arch/unicore32/mm/fault.c | |||
@@ -278,6 +278,13 @@ retry: | |||
278 | (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) | 278 | (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) |
279 | return 0; | 279 | return 0; |
280 | 280 | ||
281 | /* | ||
282 | * If we are in kernel mode at this point, we | ||
283 | * have no context to handle this fault with. | ||
284 | */ | ||
285 | if (!user_mode(regs)) | ||
286 | goto no_context; | ||
287 | |||
281 | if (fault & VM_FAULT_OOM) { | 288 | if (fault & VM_FAULT_OOM) { |
282 | /* | 289 | /* |
283 | * We ran out of memory, call the OOM killer, and return to | 290 | * We ran out of memory, call the OOM killer, and return to |
@@ -288,13 +295,6 @@ retry: | |||
288 | return 0; | 295 | return 0; |
289 | } | 296 | } |
290 | 297 | ||
291 | /* | ||
292 | * If we are in kernel mode at this point, we | ||
293 | * have no context to handle this fault with. | ||
294 | */ | ||
295 | if (!user_mode(regs)) | ||
296 | goto no_context; | ||
297 | |||
298 | if (fault & VM_FAULT_SIGBUS) { | 298 | if (fault & VM_FAULT_SIGBUS) { |
299 | /* | 299 | /* |
300 | * We had some memory, but were unable to | 300 | * We had some memory, but were unable to |