From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbbCEI2T (ORCPT ); Thu, 5 Mar 2015 03:28:19 -0500 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:64405 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbbCEI2S convert rfc822-to-8bit (ORCPT ); Thu, 5 Mar 2015 03:28:18 -0500 From: Naoya Horiguchi To: David Rientjes 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) Thread-Topic: [PATCH] mm: pagewalk: prevent positive return value of walk_page_test() from being passed to callers (Re: [PATCH] mm: fix do_mbind return value) Thread-Index: AQHQVxq4GiiuCWcL5ka5IlJgfDhsL50M8mkAgAAE8AA= Date: Thu, 5 Mar 2015 08:27:29 +0000 Message-ID: <20150305082728.GC2878@hori1.linux.bs1.fc.nec.co.jp> References: <54F7BD54.5060502@gmail.com> <20150305080226.GA28441@hori1.linux.bs1.fc.nec.co.jp> <20150305080948.GB28441@hori1.linux.bs1.fc.nec.co.jp> In-Reply-To: <20150305080948.GB28441@hori1.linux.bs1.fc.nec.co.jp> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.128.101.9] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <0E6A7D440508504D96020ADCA1C6B788@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > From 107fa3fb256bddff40a882c90af717af9863aed7 Mon Sep 17 00:00:00 2001 > > From: Naoya Horiguchi > > Date: Thu, 5 Mar 2015 16:37:37 +0900 > > Subject: [PATCH] mm: pagewalk: prevent positive return value of > > walk_page_test() from being passed to callers > > > > 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()") > > This is not a right tag. To be precise, the bug was introduced by commit > fafaa4264eba ("pagewalk: improve vma handling"), so > > Fixes fafaa4264eba ("pagewalk: improve vma handling") > > is right. > > Thanks, > Naoya Horiguchi > > > Reported-by: Kazutomo Yoshii Ah, I might be a kind of rude, the original idea was posted by Yoshii-san, and I changed it, so I may as well add his Signed-off-by (additional to Reported-by) ?