Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2420044ybi; Sun, 9 Jun 2019 11:18:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2aGAAYd187kzm8rQ4Q/hP5KyCNFGXLJ3pxAC4MEiEL1PD3k6BUmcBggajWkbfELZsxVRl X-Received: by 2002:a17:90a:db08:: with SMTP id g8mr16731436pjv.39.1560104301140; Sun, 09 Jun 2019 11:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560104301; cv=none; d=google.com; s=arc-20160816; b=Cr0h8Iiafc2eUiJRwIMsIiF3Iw+r8or7+1DKTpn7w+o2s3EYiohfEyyDFJbk3tCKKf jTSdOfyNo3ubrjHxw1Z7VgRLgbzn5SD4ZDKp7dIy7YosBZuyBWzKLmUd2/daSqfK9vID e0HADb4paFUDPYZiEbbg9pwDWxkQTeGR18xpDE6WncsYcKZERDn6ljipJ+7d5mGJcQ9C A+D4T01FlxnN5f7XyarcNX64ZP3UZI8blI/eMU85uLS9fv8VMZkKBMsce3hw4bjliRq4 SD/OIMfo+Y2s55r7sGiThbN7saaXS7piHv6xhilHDACwbDdhfuBXBe+dUqWHniM8E0hp IGSQ== 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=K4CFfnsZ8xW6xrsblCrSGSY9vLd8ulMrFApwacmOcQM=; b=ueYy31s2cget5hdfrGHxmZKI6sJtuXzBx8tQhtHShbL6SIQHaEGquEmiD3qUgodh1R UTJ1Mhqbw/gxKhTEau9Yi9oOUA/wEiT4sjckpN6/uQ8sVJisTxod9E3Qq1ClXxafiTIL He2zHPBL6Pgm1AXI36pLDA+cm+ihSpPhgvde90uXQFV1LlnkIC/q+DvTrlN2k6IwyWIy 9x0ECDoDPqwCdGHqNdvLaPVHnoIR9Y/yDwnJVi35Gw3FlkVJ0wsHyMLqKuDqFEMZyls5 J+Kaqy61t/X4K+vpbKZst9lgCc1WJpqzmm27RBcYERZbaYPnLZ4OGcqNuPCrN3jaFT7g iVIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kYWCK+Gx; 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 1si7558329pli.151.2019.06.09.11.18.04; Sun, 09 Jun 2019 11:18:21 -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=kYWCK+Gx; 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 S2388396AbfFIRDX (ORCPT + 99 others); Sun, 9 Jun 2019 13:03:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:41690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387765AbfFIRDU (ORCPT ); Sun, 9 Jun 2019 13:03:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6BC9320840; Sun, 9 Jun 2019 17:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099799; bh=exr5VrKN2HiPAqvHZsPTLreAnSfu4iNJj4l+IMGWFko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYWCK+GxA6sQj29Z6JJEocH6p/2qR/KgYO1sCFKkgNU0OjJcVgDJk0YN5Z5sUAwnB 6VFwlOLvg5L/h1IyEIqVWLjPwcKG4CrYEqqSlHM74wr4MViKWVlLjroBAkSnp71fpF y1N9XJFKw2LqyOsiXLAiHukbLwf2LurNgansMfk4= 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.4 169/241] rcutorture: Fix cleanup path for invalid torture_type strings Date: Sun, 9 Jun 2019 18:41:51 +0200 Message-Id: <20190609164152.657821644@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164147.729157653@linuxfoundation.org> References: <20190609164147.729157653@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 d89328e260df6..041a02b334d73 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1603,6 +1603,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); @@ -1741,6 +1745,7 @@ rcu_torture_init(void) pr_alert(" %s", torture_ops[i]->name); pr_alert("\n"); firsterr = -EINVAL; + cur_ops = NULL; goto unwind; } if (cur_ops->fqs == NULL && fqs_duration != 0) { -- 2.20.1