Re: [PATCH] fix error reporting in move_pages syscall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxxxx>
> 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@xxxxxxxxxxxxxx>




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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]