From nobody Fri Dec 19 20:11:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83575FA373E for ; Mon, 24 Oct 2022 13:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236539AbiJXNzB (ORCPT ); Mon, 24 Oct 2022 09:55:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236545AbiJXNxS (ORCPT ); Mon, 24 Oct 2022 09:53:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E28B0BC447; Mon, 24 Oct 2022 05:43:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3C37F6131A; Mon, 24 Oct 2022 12:32:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A45C433D6; Mon, 24 Oct 2022 12:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614730; bh=kpCVKSVx4edmN/FF2ES1UPayu/qR0i3LiEngz2CZ+Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0J0TAJcjN6INNx6uzzCZ+bJtqCGjpkWSiojqgxGPLMVnWipLpVmyl+ChJYm1JWRI ygpGDg1UJs9ditKm8V0Cu/oqM/mvxGCGbgNRyqUgHCQCrIOgOW44aSHVVPCE3hhl/5 /X1nbWM8PxlbBbA1D5HYxJI8q5qpNECZ1WwZUdHA= 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.10 372/390] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:49 +0200 Message-Id: <20221024113038.861652338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 265d9199b657..e9c13804760e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2949,7 +2949,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 =3D le16_to_cpu(id->vid); subsys->cmic =3D id->cmic; subsys->awupf =3D le16_to_cpu(id->awupf); @@ -3110,6 +3109,8 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |=3D core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); =20 if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_c= ore.force_apst -- use at your own risk\n"); --=20 2.35.1