From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751785AbcFYQLX (ORCPT ); Sat, 25 Jun 2016 12:11:23 -0400 Received: from mga03.intel.com ([134.134.136.65]:27815 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbcFYQLV (ORCPT ); Sat, 25 Jun 2016 12:11:21 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,527,1459839600"; d="scan'208";a="1009541782" From: Chen Yu To: linux-pm@vger.kernel.org, x86@kernel.org Cc: "Rafael J. Wysocki" , Len Brown , Peter Zijlstra , "H. Peter Anvin" , Borislav Petkov , Pavel Machek , Brian Gerst , Thomas Gleixner , Ingo Molnar , Varun Koyyalagunta , linux-kernel@vger.kernel.org, Chen Yu Subject: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it is NULL Date: Sun, 26 Jun 2016 00:18:30 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); /* @@ -1072,6 +1074,8 @@ void enable_nonboot_cpus(void) { int cpu, error; + if (frozen_cpus == NULL) + return; /* Allow everyone to use the CPU hotplug again */ cpu_maps_update_begin(); WARN_ON(--cpu_hotplug_disabled < 0); -- 2.7.4