Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4121181rwi; Sat, 22 Oct 2022 05:32:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4clD/efkButwR9cs7Bgt7mYqA0ELQUGdelCiiP2if43ttsffPST3T7rvQ1qnVGuAJIBj5L X-Received: by 2002:a50:ccc2:0:b0:460:4db2:5006 with SMTP id b2-20020a50ccc2000000b004604db25006mr12852811edj.369.1666441950657; Sat, 22 Oct 2022 05:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666441950; cv=none; d=google.com; s=arc-20160816; b=R1nvKSZAIwom7qaixjGB+lXFxsYwlLgT009VxXHeuYabbzV3JxKrQET1EPVNka6qhd 3naAOQrrQO7XFFHS99DJ7C2o41fruBYrh5MAzX2BVkjxSj1AjaeZWS6Id/kmPviCFMWu 9FpMApMJUfkcnAPMa8qwhL+tna/XHtRdRfv65tWpUPNb2FnShdLsUZK1/Rc+p9btyh7G nc3tr1cxgi5BkY2Xmklz1n3zklTnv3l3jApKAHKuev/dfbNZ7AwR8ESijWufNZRa9U+a BPitT4RtAQvsOQmOHVVgPOGKsKbl/I0aoS/mjmQTGNLqGJhpF9ERXVjRPEyz3r+0SyAU ro3A== 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=i2y/p7vxWmX9iOormToxEIsattVjo1I9VVd2Yv65t88=; b=t6wDvbOj6R0uC1vmet3x1/nQDRrWNukEvX7ufCJQwuc+9HypIZb02bexqjMWLnMrzS Hv5HwYiKkwJAAVmYRZ7BnQzrddR0HqbfF4OiXEzEX+BwKl55d+Ln0AnpGXD3/eivP+gP bsiuPTbnUHNziX/4o2X+67m06ft6Irwr3mVB7+uxWtBQeUxzMCpa0OUE1F7ypF5Ff2l8 9y8eOWvlOmj+ufkVyo7dhAF3TzuwwVRladzLGmXl5hrcX6CZf+YUTrLb7Gya+TnkRqrF YN/uIpJ7DpRHV5uIvhWfJ8nRssxTQYeXv5IUQJe3NVOuMVjCeqeI80fJ/VWmJt5eeuKC 2vtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wT4vddH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz2-20020a1709072ce200b0079ca59305a6si4219628ejc.354.2022.10.22.05.32.05; Sat, 22 Oct 2022 05:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wT4vddH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiJVLT2 (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiJVLTD (ORCPT ); Sat, 22 Oct 2022 07:19:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1695F231; Sat, 22 Oct 2022 03:46:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4376FB82E45; Sat, 22 Oct 2022 08:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A074C433D7; Sat, 22 Oct 2022 08:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426053; bh=mfF7iVgzEiNCmdKqx1IbQXbWdrARJ0crLzZe8h5R+h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wT4vddH4d0rJencWI6DWGxJReXc5bciO6T25XCibm5fNn3j1Z2ZmDeWcHnzEnNH1o wwW7kMcfymS7oxY0JQl275TiJGZaCmSNdK57EaAW+NFTGvHzoKMlxB7uDr4u+lL1rX IzHo6fzR9ofGUc4oaiOkVEIR1WWB1tG8RcI4WQ7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Lien , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.19 686/717] nvme: copy firmware_rev on each init Date: Sat, 22 Oct 2022 09:29:25 +0200 Message-Id: <20221022072528.833925702@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch [ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ] The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data. Reported-by: Jeff Lien Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 47fd9d528c83..698e65883d82 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2796,7 +2796,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; @@ -3015,6 +3014,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); -- 2.35.1