linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: make apply_to_page_range more robust
@ 2016-01-15  5:41 Mika Penttilä
  2016-01-17 10:02 ` Pekka Enberg
  2016-01-19 22:21 ` David Rientjes
  0 siblings, 2 replies; 3+ messages in thread
From: Mika Penttilä @ 2016-01-15  5:41 UTC (permalink / raw)
  To: LKML, linux-mm

Recent changes (4.4.0+) in module loader triggered oops on ARM. While
loading a module, size in :

apply_to_page_range(struct mm_struct *mm, unsigned long addr,   unsigned
long size, pte_fn_t fn, void *data);

can be 0 triggering the bug  BUG_ON(addr >= end);.

Fix by letting call with zero size succeed.

--Mika

Signed-off-by: mika.penttila@nextfour.com
---

diff --git a/mm/memory.c b/mm/memory.c
index c387430..c3d1a2e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1884,6 +1884,9 @@ int apply_to_page_range(struct mm_struct *mm,
unsigned long addr,
        unsigned long end = addr + size;
        int err;

+       if (!size)
+               return 0;
+
        BUG_ON(addr >= end);
        pgd = pgd_offset(mm, addr);
        do {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-19 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15  5:41 [PATCH] mm: make apply_to_page_range more robust Mika Penttilä
2016-01-17 10:02 ` Pekka Enberg
2016-01-19 22:21 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).