lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 31 Oct 2023 14:20:29 +0000
From:   Niklas Cassel <Niklas.Cassel@....com>
To:     Daniel Wagner <dwagner@...e.de>
CC:     "linux-nvme@...ts.infradead.org" <linux-nvme@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Keith Busch <kbusch@...nel.org>,
        Christoph Hellwig <hch@....de>,
        Kenji Tomonaga <tkenbo@...il.com>
Subject: Re: [PATCH v3] nvme: update firmware version after commit

On Mon, Oct 30, 2023 at 05:00:44PM +0100, Daniel Wagner wrote:
> The firmware version sysfs entry needs to be updated after a successfully
> firmware activation.
> 
> nvme-cli stopped issuing an Identify Controller command to list the
> current firmware information and relies on sysfs showing the current
> firmware version.
> 
> Reported-by: Kenji Tomonaga <tkenbo@...il.com>
> Signed-off-by: Daniel Wagner <dwagner@...e.de>
> ---
> 
> Only compile tested. Asked for testing.
> 
> changes:
> 
> v3:
>   - use afi variable directly, no _to_cpu helper
>   - fix bit mask size
> 
> v2:
>   - use fw slot info instead issuing another identify controller command
>   - https://lore.kernel.org/linux-nvme/20231013163420.3097-1-dwagner@suse.de
> 
> v1:
>   - initial version
>   - https://lore.kernel.org/linux-nvme/20231013062623.6745-1-dwagner@suse.de/
> 
> 
>  drivers/nvme/host/core.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 37b6fa746662..e8511bff78d2 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4053,8 +4053,21 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
>  		return;
>  
>  	if (nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 0, NVME_CSI_NVM,
> -			log, sizeof(*log), 0))
> +			 log, sizeof(*log), 0)) {
>  		dev_warn(ctrl->device, "Get FW SLOT INFO log error\n");
> +		goto out_free_log;
> +	}
> +
> +	if (log->afi & 0x70) {
> +		dev_info(ctrl->device,
> +			 "Firmware is activated after next Controller Level Reset\n");
> +		goto out_free_log;
> +	}
> +
> +	memcpy(ctrl->subsys->firmware_rev, &log->frs[log->afi & 0x7],
> +		sizeof(ctrl->subsys->firmware_rev));
> +
> +out_free_log:
>  	kfree(log);
>  }
>  
> -- 
> 2.42.0
> 

Reviewed-by: Niklas Cassel <niklas.cassel@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ