[PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl

Christoph Hellwig hch at lst.de
Wed Mar 23 23:04:04 PDT 2022


> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 12d4afde3662..d36f2543ebe1 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -712,11 +712,13 @@ static void nvme_ana_work(struct work_struct *work)
>  
>  void nvme_mpath_update(struct nvme_ctrl *ctrl)
>  {
> -	u32 nr_change_groups = 0;
> +	if (ctrl->ana_log_buf) {
> +		u32 nr_change_groups = 0;
>  
> -	mutex_lock(&ctrl->ana_lock);
> -	nvme_parse_ana_log(ctrl, &nr_change_groups, nvme_update_ana_state);
> -	mutex_unlock(&ctrl->ana_lock);
> +		mutex_lock(&ctrl->ana_lock);
> +		nvme_parse_ana_log(ctrl, &nr_change_groups, nvme_update_ana_state);

Overly long line.  Kust retun early for the !ana_log_buf case
to sort this out trivially.



More information about the Linux-nvme mailing list