From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753943AbcBGMdl (ORCPT ); Sun, 7 Feb 2016 07:33:41 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35849 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753426AbcBGMdk (ORCPT ); Sun, 7 Feb 2016 07:33:40 -0500 From: Artem Savkov To: paulmck@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH] rcuperf: Do not wake up shutdown wait queue if "shutdown" is false. Date: Sun, 7 Feb 2016 13:31:39 +0100 Message-Id: <1454848299-25194-1-git-send-email-artem.savkov@gmail.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After finishing it's tests rcuperf tries to wake up shutdown_wq even if "shutdown" param is set to false, resulting in a wake_up() call on an unitialized wait_queue_head_t which leads to "BUG: spinlock bad magic" and "BUG: unable to handle kernel NULL pointer dereference". Fix by checking "shutdown" param before waking up the queue. Signed-off-by: Artem Savkov --- kernel/rcu/rcuperf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c index 09ffa36..fb45a26 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c @@ -414,8 +414,10 @@ rcu_perf_writer(void *arg) b_rcu_perf_writer_finished = cur_ops->completed(); } - smp_mb(); /* Assign before wake. */ - wake_up(&shutdown_wq); + if (shutdown) { + smp_mb(); /* Assign before wake. */ + wake_up(&shutdown_wq); + } } } if (done && !alldone && -- 2.7.0