linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org,
	cl@linux-foundation.org
Subject: Re: [PATCH] fix error reporting in move_pages syscall
Date: Fri, 22 Oct 2010 11:12:42 +0900 (JST)	[thread overview]
Message-ID: <20101022110754.53B5.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20101019101505.GG10207@redhat.com>

> vma returned by find_vma does not necessary include given address. If
> this happens code tries to follow page outside of any vma and returns
> ENOENT instead of EFAULT.
> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 38e7cad..b91a253 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -841,7 +841,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
>  
>  		err = -EFAULT;
>  		vma = find_vma(mm, pp->addr);
> -		if (!vma || !vma_migratable(vma))
> +		if (!vma || pp->addr < vma->vm_start || !vma_migratable(vma))
>  			goto set_status;
>  
>  		page = follow_page(vma, pp->addr, FOLL_GET);
> @@ -1005,7 +1005,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
>  		int err = -EFAULT;
>  
>  		vma = find_vma(mm, addr);
> -		if (!vma)
> +		if (!vma || addr < vma->vm_start)
>  			goto set_status;
>  
>  		page = follow_page(vma, addr, 0);
> --
> 			Gleb.

Looks good to me.
	Revewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




--
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>

      parent reply	other threads:[~2010-10-22  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 10:15 Gleb Natapov
2010-10-21 18:27 ` Gleb Natapov
2010-10-21 18:55 ` Christoph Lameter
2010-10-22  2:12 ` KOSAKI Motohiro [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=20101022110754.53B5.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=cl@linux-foundation.org \
    --cc=gleb@redhat.com \
    --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