Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp189625pxx; Wed, 28 Oct 2020 02:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1Gzehw/BjAL+/w0bWaKWn+ts1YTF119hT2a57wiV7ZqVoHKsbTBVFBWS8qJEAup8os8ab X-Received: by 2002:a17:906:d86:: with SMTP id m6mr6198529eji.331.1603876285720; Wed, 28 Oct 2020 02:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876285; cv=none; d=google.com; s=arc-20160816; b=FrcaK0m+LxV2b1pTgub0vMYh8Zgf3zDb5iic7TPKbZSuUQZCQOuyFJWUiqD2YN2pq3 wpm9MW7O+Q1HlrWQO066MTtvFoa/yKuCJed0PjJFXks7bEcy1SnpYNwLyJvioRbPBPEP 43ETuJtJ65OApbJnWQjocS7enYzln5eW7QWrLPqKSPYVQgSlrLIPWlfivmaUGSmr5dFK 3r8ffMO8u+8zGce/A2JoW2DTDXSqX+/6eQsCs+7CD5ECN3pbWx/qg/i5Fz7rs0ykzNjW 6avK6XEzefwUE2q3P4f16qv+bEJOSZUrrK7asBoWEPPvBq1qGp2eyyugST3vcA2BMhLV porw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M0DYD2G07VeAO37gJc7xnYgn7QED9H2LoUNI62aTQl4=; b=MLG6T1NvP+jZIFG96GcqMNBwZgNxd+hRxjZxjbkWL6ec1u/PhIbKjk8v9bDotXZqkm sA8sdCM3WivjxSNrDCS8a8VlHwpSmTC1+705kmwMfa45mwbi5ZtjilNYAMoWvNmbm7lM DoC3r0TsPHwkHpZNs88A3EJtDxMVTDsw2nuM/kYGxuLakHRr0wFil/9BAwwEPZGUDJxV oZpPeSr/Z/1cJzKQcx7w6kTggfXT4qxKcA2MDT+0j55dIS1Mie1XgjJNpqZ89J6PNNYd bkOvur+KdRoXSahjC6ruaCH837ViggdgGbNmfn/8UmMFj2BBfcH8UUYLyQtAm0YnZNCp ji9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRIqAYuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si2705925ejr.482.2020.10.28.02.11.03; Wed, 28 Oct 2020 02:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRIqAYuo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2900913AbgJ0OR3 (ORCPT + 99 others); Tue, 27 Oct 2020 10:17:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:35518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756533AbgJ0ON7 (ORCPT ); Tue, 27 Oct 2020 10:13:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 F3CA422202; Tue, 27 Oct 2020 14:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808038; bh=5aVxXH2hfBok8jq0rnv+jq84u8ADiglFgjUXXTp+p2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRIqAYuoksAJs9CBFTOWLahBipMFBgcLzXFHtSeJdp0TZSTBGn+1Bo3GrnK8JVO0o UFNCxpppfK2tm9GU14r91pUDBHPcd1kpGmP5ENUJLkB9tcLKDBsBfFwmuMlOr14np/ gbOMgIX2EHGpSK+D9TA/VyAqGFYDbfNu42Lqbz38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, zhenwei pi , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 132/191] nvmet: fix uninitialized work for zero kato Date: Tue, 27 Oct 2020 14:49:47 +0100 Message-Id: <20201027134916.047498395@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhenwei pi [ Upstream commit 85bd23f3dc09a2ae9e56885420e52c54bf983713 ] When connecting a controller with a zero kato value using the following command line nvme connect -t tcp -n NQN -a ADDR -s PORT --keep-alive-tmo=0 the warning below can be reproduced: WARNING: CPU: 1 PID: 241 at kernel/workqueue.c:1627 __queue_delayed_work+0x6d/0x90 with trace: mod_delayed_work_on+0x59/0x90 nvmet_update_cc+0xee/0x100 [nvmet] nvmet_execute_prop_set+0x72/0x80 [nvmet] nvmet_tcp_try_recv_pdu+0x2f7/0x770 [nvmet_tcp] nvmet_tcp_io_work+0x63f/0xb2d [nvmet_tcp] ... This is caused by queuing up an uninitialized work. Althrough the keep-alive timer is disabled during allocating the controller (fixed in 0d3b6a8d213a), ka_work still has a chance to run (called by nvmet_start_ctrl). Fixes: 0d3b6a8d213a ("nvmet: Disable keep-alive timer when kato is cleared to 0h") Signed-off-by: zhenwei pi Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index d0be85d0c289a..7d6d30a2d7719 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -611,7 +611,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) * in case a host died before it enabled the controller. Hence, simply * reset the keep alive timer when the controller is enabled. */ - mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); + if (ctrl->kato) + mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); } static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl) -- 2.25.1