linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: "Mika Penttilä" <mika.penttila@nextfour.com>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: Re: [PATCH] mm: make apply_to_page_range more robust
Date: Tue, 19 Jan 2016 14:21:27 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1601191420030.7346@chino.kir.corp.google.com> (raw)
In-Reply-To: <5698866F.1070802@nextfour.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1137 bytes --]

On Fri, 15 Jan 2016, Mika PenttilA? 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
> ---
> 
> 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 {

What is calling apply_to_page_range() with size == 0?  I'm not sure we 
should be adding "robust"ness here and that size == 0 is actually an 
indication of a bug somewhere else that we want to know about.

Btw, your patch is line-wrapped and your sign-off-line doesn't include 
your full name.

      parent reply	other threads:[~2016-01-19 22:21 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
2016-01-19 22:21 ` David Rientjes [this message]

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=alpine.DEB.2.10.1601191420030.7346@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --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