Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp269987ybi; Wed, 29 May 2019 21:04:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZTNEeaa5tXhDwKsTpeWGnSBrI8vR3qU51GaJtpoFG5jeQzEWgEgasgZc2oNqXJQKPhFhP X-Received: by 2002:a17:90a:9f93:: with SMTP id o19mr1813882pjp.70.1559189047773; Wed, 29 May 2019 21:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559189047; cv=none; d=google.com; s=arc-20160816; b=C5/Np1zXNCOY/F9SQHCD6FGlEzCPLDcMSpHPnkJWtmJcmGuHlCpHf9b+M5NpqN0OnC ChU7Wrzn/80o/f3twKaufkhp46lc6zTW4uShlR3X/D3oilG8ZTpCl4NkLkKlWE0yxZc1 d6dZqrbv/YPAQ+IBMpiSVsN1caJa4AhgMxQqNfUmZGz4Op78UpyDlhlEcFMFz1OVhflD P00YfPpxmS45gJksbxbBnora77D/kvNsinEgMIw9VYmGrooTiN+WbuSI8EI9m+EkNvFe XZrJgHLf2B+cPrOuTObBPaUugMGjaoRtxY4OcrYEWZ1sGJlAp25jGU1qhqnzGVZ+mP7G qEjQ== 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=e0eMx9eD7UlqWK987civjDbjqzT3he4BRH1KqT4/3bw=; b=QiZV7SWWS7oIbi+hYGPPWL/dOcll7SE+Auv3kwWzcDeW7GxS+fPij5R+FfBYcrSFAQ +O5zKThh5ODPpukB8ysjZK7juDASN/+rbhHBQWBmfGZ99qaOgJvE4hqojHzRkD6NWq/e SFR5L+hU7LofUgX5a/KPKjeHa2p4DA6Y/zzOmxcz/hOFulz7ILHhrbhZr1voqj9D0EMd 5Fs/kr3uh/ETvChzSNTfMZn6GZF1vOooJnFvA5xUKxsVcOgemTPsqE92AS2vPff6jiy/ oFg7XwJ9RTmVZYwtkGctLmEF6d7Tey51SiiQxEjgSUVJH7UOJnzn+5+OUFsnZWacN/5V WRCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EmVAV1cM; 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 s15si1962642pgi.507.2019.05.29.21.03.51; Wed, 29 May 2019 21:04:07 -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=EmVAV1cM; 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 S1732035AbfE3ECf (ORCPT + 99 others); Thu, 30 May 2019 00:02:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:49640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730465AbfE3DSB (ORCPT ); Wed, 29 May 2019 23:18:01 -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 186F624760; Thu, 30 May 2019 03:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186281; bh=rUom6fya4qpqz8Hi67+pvk/A3ZVJMOFfbtAwZZ1KJUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EmVAV1cMlDWU6q/wzOCu1Ee9lRtTlSi6YORCrEL9bLDNXhEnzZ48F9V+XIATexTxe 6NT6mMwx8y4A/0Rk2jP5E5KBE8h+s3evebrd5Rfh89gQiMq8VC4A60O1Fg7+b27fcW sCewo2WUtKb9Uy3bFr6thx5errvtBSvFd/Zm1SjI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 4.19 232/276] rcutorture: Fix cleanup path for invalid torture_type strings Date: Wed, 29 May 2019 20:06:30 -0700 Message-Id: <20190530030539.640331172@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 b813afae7ab6a5e91b4e16cc567331d9c2ae1f04 ] If the specified rcutorture.torture_type is not in the rcu_torture_init() function's torture_ops[] array, rcutorture prints some console messages and then invokes rcu_torture_cleanup() to set state so that a future torture test can run. However, rcu_torture_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_torture_cleanup(), thus avoiding relying on an irrelevant cur_ops value. Reported-by: kernel test robot Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/rcutorture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index c596c6f1e4571..0b7af7e2bcbb1 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1826,6 +1826,10 @@ rcu_torture_cleanup(void) cur_ops->cb_barrier(); return; } + if (!cur_ops) { + torture_cleanup_end(); + return; + } rcu_torture_barrier_cleanup(); torture_stop_kthread(rcu_torture_stall, stall_task); @@ -1964,6 +1968,7 @@ rcu_torture_init(void) pr_cont(" %s", torture_ops[i]->name); pr_cont("\n"); firsterr = -EINVAL; + cur_ops = NULL; goto unwind; } if (cur_ops->fqs == NULL && fqs_duration != 0) { -- 2.20.1