Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933553AbdCJJQq (ORCPT ); Fri, 10 Mar 2017 04:16:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36702 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932912AbdCJJQm (ORCPT ); Fri, 10 Mar 2017 04:16:42 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , "K. Y. Srinivasan" Subject: [PATCH 4.4 68/91] hv: allocate synic pages for all present CPUs Date: Fri, 10 Mar 2017 10:09:07 +0100 Message-Id: <20170310083904.172179248@linuxfoundation.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170310083900.730556986@linuxfoundation.org> References: <20170310083900.730556986@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1110 Lines: 41 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vitaly Kuznetsov commit 421b8f20d3c381b215f988b42428f56fc3b82405 upstream. It may happen that not all CPUs are online when we do hv_synic_alloc() and in case more CPUs come online later we may try accessing these allocated structures. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- drivers/hv/hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -422,7 +422,7 @@ int hv_synic_alloc(void) goto err; } - for_each_online_cpu(cpu) { + for_each_present_cpu(cpu) { hv_context.event_dpc[cpu] = kmalloc(size, GFP_ATOMIC); if (hv_context.event_dpc[cpu] == NULL) { pr_err("Unable to allocate event dpc\n"); @@ -485,7 +485,7 @@ void hv_synic_free(void) int cpu; kfree(hv_context.hv_numa_map); - for_each_online_cpu(cpu) + for_each_present_cpu(cpu) hv_synic_free_cpu(cpu); }