Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp270685ybi; Wed, 29 May 2019 21:05:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfe9Ie9Tg75c8tb7vpVx5LXUS1aAoBlKIohU5qYHP7BNe3TciDx2JCNIvR827YUPnWk2FN X-Received: by 2002:a62:4dc5:: with SMTP id a188mr1731383pfb.8.1559189101376; Wed, 29 May 2019 21:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559189101; cv=none; d=google.com; s=arc-20160816; b=GrdnnAItW2g6sORfTeZgWAPb62N6u+Ub21yihclzl6JMvyByWdBUAR3qDaj/uKAZlQ vT3SfRcuQHaCrZc6kSrXSMPle2Pq5LDYb8sEoLM4r+UKcno/Os6YD3x4PozgELcSUtI3 RNG/ZBaoX+EukTGMU9FGDW7avWLcy+Z/H86KQ1QVZjCG3MGK2Q3KBuXeG7JAO5vG5MNF bZ7QEjmFVoomrlloypXJO8W5c0IGYY3mUlUqv8sUrCSGXSXaXsVZrqL2jkYDeq7w0oRE BEuTGToAntm08CVM1rQW1Hem11Aixgf37iXDCIZ/KP/iNfvYiNqGnSK3Rk2vgr5GMfK4 5dhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=77PnENnGDVGcxAWscgP5KQVE/eqIs2vigxppdAMe3X4=; b=F+b/7NKPRQDaTpWUWmpXrwa4AUeYGSWaSX/T/+JNiHu+eUm8dNefxx4R4H5JCiVorA uAgxqqt3n1sZ7HTw2v436rAX8B+1HCh80FNqhx5PXey6j/6Ch+DAyJWh95BuR1isPDYM BFxxrBG4EBs2tk16qc5I3nHhTZi2XL1Gq2GGRD4zY4ba4RrXRg5HTtCGQ8AWKBP/+imx CC2hrqEfHBZJc7OlBEgODs1lfr51v3cXuRuiNonChcoCMIxG3UKuEdjPhUP/mt1w0rLq AWAoiZGKiRSFlgOxgS0yUpDe7Z8xCb2sznCi//wIKcCGEiFMhfXSQRAcziXzp1JEdmc5 rB7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P34Zv68L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si1574750pjs.78.2019.05.29.21.04.44; Wed, 29 May 2019 21:05:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P34Zv68L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731470AbfE3ECN (ORCPT + 99 others); Thu, 30 May 2019 00:02:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731393AbfE3DSC (ORCPT ); Wed, 29 May 2019 23:18:02 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10A5124733; Thu, 30 May 2019 03:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186282; bh=688BSSCjm1VH0CTrn3FpYfvI2i1PqdHOIh0iUUQkLaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P34Zv68LFL3/cYDXPVYwafE860h8YKS9vUxxkVBjEs7s+Re3M04xA2q67BJS/EgU4 3WljBeo7XzIiHjVtT6YKMXIfSL8oBpdiuMDshBt0W45IUFOnk1YcoFvF+r3V1Qz/yC Qpd0+MdWO4ov/BDq48uzynMKfXSkBt3ebZMty/zc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 4.19 234/276] rcuperf: Fix cleanup path for invalid perf_type strings Date: Wed, 29 May 2019 20:06:32 -0700 Message-Id: <20190530030539.764604914@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit ad092c027713a68a34168942a5ef422e42e039f4 ] If the specified rcuperf.perf_type is not in the rcu_perf_init() function's perf_ops[] array, rcuperf prints some console messages and then invokes rcu_perf_cleanup() to set state so that a future torture test can run. However, rcu_perf_cleanup() also attempts to end the test that didn't actually start, and in doing so relies on the value of cur_ops, a value that is not particularly relevant in this case. This can result in confusing output or even follow-on failures due to attempts to use facilities that have not been properly initialized. This commit therefore sets the value of cur_ops to NULL in this case and inserts a check near the beginning of rcu_perf_cleanup(), thus avoiding relying on an irrelevant cur_ops value. Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/rcuperf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c index 34244523550e1..19249b86fb33e 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c @@ -561,6 +561,10 @@ rcu_perf_cleanup(void) if (torture_cleanup_begin()) return; + if (!cur_ops) { + torture_cleanup_end(); + return; + } if (reader_tasks) { for (i = 0; i < nrealreaders; i++) @@ -681,6 +685,7 @@ rcu_perf_init(void) pr_cont(" %s", perf_ops[i]->name); pr_cont("\n"); firsterr = -EINVAL; + cur_ops = NULL; goto unwind; } if (cur_ops->init) -- 2.20.1