From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751748AbcFYQvS (ORCPT ); Sat, 25 Jun 2016 12:51:18 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:45491 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751355AbcFYQvR (ORCPT ); Sat, 25 Jun 2016 12:51:17 -0400 Date: Sat, 25 Jun 2016 18:51:13 +0200 From: Pavel Machek To: Chen Yu Cc: linux-pm@vger.kernel.org, x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Peter Zijlstra , "H. Peter Anvin" , Borislav Petkov , Brian Gerst , Thomas Gleixner , Ingo Molnar , Varun Koyyalagunta , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it is NULL Message-ID: <20160625165113.GA4362@amd> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 2016-06-26 00:18:30, Chen Yu wrote: > frozen_cpus might be NULL if the allocation in previous > alloc_frozen_cpus failed, when CONFIG_CPUMASK_OFFSTACK > is set. > > This patch avoid accessing this cpumask if it is NULL. > > Signed-off-by: Chen Yu > --- > kernel/cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index d948e44..d25266e 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -1021,6 +1021,8 @@ int disable_nonboot_cpus(void) > { > int cpu, first_cpu, error = 0; > > + if (frozen_cpus == NULL) > + return -ENOMEM; > cpu_maps_update_begin(); > first_cpu = cpumask_first(cpu_online_mask); > /* I'd say that whoever allocates frozen_cpus should just abort the hibernation if there's not enough memory for the operation...? This seems like checking for the problem too late. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html