Re: [PATCH] nvme: verify MNAN value if ANA is enabled
From: Christoph Hellwig
Date: Thu Jun 03 2021 - 03:16:58 EST
> @@ -2972,6 +2972,16 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
> if (ret < 0)
> goto out_free;
>
> +#ifdef CONFIG_NVME_MULTIPATH
> + if (ctrl->ana_log_buf && (!ctrl->max_namespaces ||
> + ctrl->max_namespaces > le32_to_cpu(id->nn))) {
> + dev_err(ctrl->device,
> + "Invalid MNAN value %u\n", ctrl->max_namespaces);
> + ret = -EINVAL;
> + goto out_free;
> + }
> +#endif
Please move the check into nvme_mpath_init_identify, where we can avoid
the ifdef and the ana_log_buf check, which won't trigger for the first
initialization.