Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp259188ybi; Wed, 29 May 2019 20:50:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi1j0zT823KxgckNBSZGKtXIZ3Qi1/z4FBXtjctpon9Ho1AfMphHEAiu+XoHqX973rmv1w X-Received: by 2002:a63:ce04:: with SMTP id y4mr1797830pgf.66.1559188241969; Wed, 29 May 2019 20:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188241; cv=none; d=google.com; s=arc-20160816; b=tCob7C3ip5hUI+U1Guh3yjURLclI8YDOOjRD9Jobxq6/rh81mXMYN464G7qnQxcBqd k5Yqw7k073TLMP3HT9pje7SNQK/c4iZgAtDu4zaF2SROVp/AFV6EiPe3Jy89OHUgQqSi 64m2zxg3duVXgoEQe0qhW/LdVLzsMj9hKA/nPvxZGeWA8WWp4BGcl0SDr11uxCvfxHUu MWZCQUF4u/stAtqSK759cC/honxw2TJMITBd7cgJCyz72xDkWI4V3bHRcr+jaDbIY7OU vggUUrZbcQMHabLqBSS7q/yuo9KY7iv6OxkcZe2NkCYWHcUyN2f6K7t31KyxgiZe2zds hobw== 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=kuAiDhLk1jY6/Uj9GPe8vyMpI2MUQ3kzs5toE8q+ing=; b=EyxU5ctP88LV0CvECQ3aXvm8WEHVMx1MMmQ83+g2+fun0W5aYTZy1OuoOncXi+smbd NZv9/OOX7fHzM7LUKKi2xjR7LPnjIZOWqgxmVMNt03aXFcv8yeas06t3f0e5+RjRofGL qGoJto4LLsrtMjel3qRpBxzC5S6VWRBQLz9dJqtCXqA54l5RYRJTFN9bVoeY91zxA+Ea Dyhopl6N6+TmjdlhTwYcHqOThNt0c83LhKry/DAQdrh28YuHiqyMi60zK0eZKjY326Q7 SKTfUz0f8kCe5Q8lwp32vKbhE95PybsRcb9yU0BcnGi6dNgNwjJrlM8F8ww1UR+TySWI 8dRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rsqPxDk5; 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 f3si2063749pld.434.2019.05.29.20.50.26; Wed, 29 May 2019 20:50:41 -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=rsqPxDk5; 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 S2387549AbfE3Dsd (ORCPT + 99 others); Wed, 29 May 2019 23:48:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:58016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732156AbfE3DUT (ORCPT ); Wed, 29 May 2019 23:20:19 -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 1088E248EA; Thu, 30 May 2019 03:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186419; bh=qhUPIOZDf5n5/v9M18yrBJksrLTGbpEW3T687eaFetg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsqPxDk5xUXyPMC+E0sKuV9may0ULolsB/bS3gyjc64E9v4cAyo6So/4lHeeS41/e HwtiMoRuwpCMGtn+sjh6/38jpzQsmoDXqZmpFomU+qhzmSBcaaCde5jCvSIl3aFVFP 905o9H2MPYExYFybLuQZxmlZl82U3JuY+ulgLjmo= 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.14 171/193] rcuperf: Fix cleanup path for invalid perf_type strings Date: Wed, 29 May 2019 20:07:05 -0700 Message-Id: <20190530030511.785867340@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@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 1f87a02c33999..9b0d38812eb62 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c @@ -542,6 +542,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++) @@ -663,6 +667,7 @@ rcu_perf_init(void) pr_alert(" %s", perf_ops[i]->name); pr_alert("\n"); firsterr = -EINVAL; + cur_ops = NULL; goto unwind; } if (cur_ops->init) -- 2.20.1