From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx173.postini.com [74.125.245.173]) by kanga.kvack.org (Postfix) with SMTP id 8909B6B0031 for ; Wed, 11 Sep 2013 01:37:35 -0400 (EDT) Received: by mail-pd0-f179.google.com with SMTP id v10so8743654pde.10 for ; Tue, 10 Sep 2013 22:37:34 -0700 (PDT) Date: Tue, 10 Sep 2013 22:32:48 -0700 From: Anton Vorontsov Subject: Re: [PATCH] vmpressure: fix divide-by-0 in vmpressure_work_fn Message-ID: <20130911053248.GA9064@lizard> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Andrew Morton , Michal Hocko , David Rientjes , linux-kernel@vger.kernel.org, linux-mm@kvack.org On Fri, Sep 06, 2013 at 10:59:16PM -0700, Hugh Dickins wrote: > Hit divide-by-0 in vmpressure_work_fn(): checking vmpr->scanned before > taking the lock is not enough, we must check scanned afterwards too. > > Signed-off-by: Hugh Dickins > Cc: stable@vger.kernel.org Hm... Just trying to understand this one. I don't see how this can happen, considering that only one instance of vmpressure_work_fn() supposed to be running (unlike vmpressure()), and the only place where we zero vmpr->scanned is vmpressure_work_fn() itself? > --- > > mm/vmpressure.c | 3 +++ > 1 file changed, 3 insertions(+) > > --- 3.11/mm/vmpressure.c 2013-09-02 13:46:10.000000000 -0700 > +++ linux/mm/vmpressure.c 2013-09-06 22:43:03.596003080 -0700 > @@ -187,6 +187,9 @@ static void vmpressure_work_fn(struct wo > vmpr->reclaimed = 0; > spin_unlock(&vmpr->sr_lock); > > + if (!scanned) > + return; > + > do { > if (vmpressure_event(vmpr, scanned, reclaimed)) > break; -- 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: email@kvack.org