From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbdARAIZ (ORCPT ); Tue, 17 Jan 2017 19:08:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:36266 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751509AbdARAEW (ORCPT ); Tue, 17 Jan 2017 19:04:22 -0500 From: Vlastimil Babka To: Mel Gorman , Ganapatrao Kulkarni Cc: Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka Subject: [RFC 1/4] mm, page_alloc: fix check for NULL preferred_zone Date: Tue, 17 Jan 2017 23:16:07 +0100 Message-Id: <20170117221610.22505-2-vbabka@suse.cz> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117221610.22505-1-vbabka@suse.cz> References: <20170117221610.22505-1-vbabka@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice") we have a wrong check for NULL preferred_zone, which can theoretically happen due to concurrent cpuset modification. We check the zoneref pointer which is never NULL and we should check the zone pointer. Fixes: c33d6c06f60f ("mm, page_alloc: avoid looking up the first zone in a zonelist twice") Signed-off-by: Vlastimil Babka --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 34ada718ef47..593a11d8bc6b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3763,7 +3763,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, */ ac.preferred_zoneref = first_zones_zonelist(ac.zonelist, ac.high_zoneidx, ac.nodemask); - if (!ac.preferred_zoneref) { + if (!ac.preferred_zoneref->zone) { page = NULL; goto no_zone; } -- 2.11.0