From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629AbbKOShN (ORCPT ); Sun, 15 Nov 2015 13:37:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57373 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbbKOShK (ORCPT ); Sun, 15 Nov 2015 13:37:10 -0500 Date: Sun, 15 Nov 2015 20:33:11 +0100 From: Oleg Nesterov To: Ingo Molnar , Peter Zijlstra Cc: Milos Vyletel , Prarit Bhargava , Tejun Heo , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 1/8] stop_machine: cpu_stopper_thread() must check done != NULL Message-ID: <20151115193311.GA8242@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151115193254.GA8225@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org stop_one_cpu_nowait(fn) will crash the kernel if the callback returns nonzero, work->done == NULL in this case. This needs more cleanups, cpu_stop_signal_done() is called right after we check done != NULL and it does the same check. Signed-off-by: Oleg Nesterov --- kernel/stop_machine.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 867bc20..1a66a95 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -454,7 +454,7 @@ repeat: preempt_disable(); ret = fn(arg); - if (ret) + if (ret && done) done->ret = ret; /* restore preemption and check it's still balanced */ -- 1.5.5.1