linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mika.penttila@nextfour.com>
To: LKML <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: [PATCH] mm: make apply_to_page_range more robust
Date: Fri, 15 Jan 2016 07:41:03 +0200	[thread overview]
Message-ID: <5698866F.1070802@nextfour.com> (raw)

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>

             reply	other threads:[~2016-01-15  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15  5:41 Mika Penttilä [this message]
2016-01-17 10:02 ` [PATCH] mm: make apply_to_page_range more robust Pekka Enberg
2016-01-19 22:21 ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5698866F.1070802@nextfour.com \
    --to=mika.penttila@nextfour.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).