From: Pekka Enberg <penberg@kernel.org>
To: "Mika Penttilä" <mika.penttila@nextfour.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: make apply_to_page_range more robust
Date: Sun, 17 Jan 2016 12:02:53 +0200 [thread overview]
Message-ID: <CAOJsxLFXts1USPU827A1zaZsggER7CVzZah7TGKzNHzqF8Ttsg@mail.gmail.com> (raw)
In-Reply-To: <5698866F.1070802@nextfour.com>
On Fri, Jan 15, 2016 at 7:41 AM, Mika Penttilä
<mika.penttila@nextfour.com> wrote:
> 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
Reviewed-by: Pekka Enberg <penberg@kernel.org>
We could also replace that BUG_ON() with a WARN_ON() and return -EINVAL.
> ---
>
> 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>
--
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>
next prev parent reply other threads:[~2016-01-17 10:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 5:41 Mika Penttilä
2016-01-17 10:02 ` Pekka Enberg [this message]
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=CAOJsxLFXts1USPU827A1zaZsggER7CVzZah7TGKzNHzqF8Ttsg@mail.gmail.com \
--to=penberg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mika.penttila@nextfour.com \
/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