From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758527AbbCEUeX (ORCPT ); Thu, 5 Mar 2015 15:34:23 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]:38190 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757862AbbCEUeT (ORCPT ); Thu, 5 Mar 2015 15:34:19 -0500 Date: Thu, 5 Mar 2015 12:34:17 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Naoya Horiguchi cc: Kazutomo Yoshii , "linux-kernel@vger.kernel.org" , Andrew Morton , "linux-mm@kvack.org" Subject: Re: [PATCH] mm: pagewalk: prevent positive return value of walk_page_test() from being passed to callers (Re: [PATCH] mm: fix do_mbind return value) In-Reply-To: <20150305080226.GA28441@hori1.linux.bs1.fc.nec.co.jp> Message-ID: References: <54F7BD54.5060502@gmail.com> <20150305080226.GA28441@hori1.linux.bs1.fc.nec.co.jp> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 Mar 2015, Naoya Horiguchi wrote: > walk_page_test() is purely pagewalk's internal stuff, and its positive return > values are not intended to be passed to the callers of pagewalk. However, in > the current code if the last vma in the do-while loop in walk_page_range() > happens to return a positive value, it leaks outside walk_page_range(). > So the user visible effect is invalid/unexpected return value (according to > the reporter, mbind() causes it.) > > This patch fixes it simply by reinitializing the return value after checked. > > Another exposed interface, walk_page_vma(), already returns 0 for such cases > so no problem. > > Fixes: 6f4576e3687b ("mempolicy: apply page table walker on queue_pages_range()") > Reported-by: Kazutomo Yoshii > Signed-off-by: Naoya Horiguchi Acked-by: David Rientjes This is exactly what I had in mind, thanks for fixing it up so fast!