Merge tag 'for-5.5/drivers-20191121' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / drivers / nvme / host / multipath.c
index e0f064d..797c183 100644 (file)
@@ -95,6 +95,7 @@ void nvme_failover_req(struct request *req)
                }
                break;
        case NVME_SC_HOST_PATH_ERROR:
+       case NVME_SC_HOST_ABORTED_CMD:
                /*
                 * Temporary transport disruption in talking to the controller.
                 * Try to send on a new path.
@@ -446,8 +447,14 @@ static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data,
 
        for (i = 0; i < le16_to_cpu(ctrl->ana_log_buf->ngrps); i++) {
                struct nvme_ana_group_desc *desc = base + offset;
-               u32 nr_nsids = le32_to_cpu(desc->nnsids);
-               size_t nsid_buf_size = nr_nsids * sizeof(__le32);
+               u32 nr_nsids;
+               size_t nsid_buf_size;
+
+               if (WARN_ON_ONCE(offset > ctrl->ana_log_size - sizeof(*desc)))
+                       return -EINVAL;
+
+               nr_nsids = le32_to_cpu(desc->nnsids);
+               nsid_buf_size = nr_nsids * sizeof(__le32);
 
                if (WARN_ON_ONCE(desc->grpid == 0))
                        return -EINVAL;
@@ -467,8 +474,6 @@ static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data,
                        return error;
 
                offset += nsid_buf_size;
-               if (WARN_ON_ONCE(offset > ctrl->ana_log_size - sizeof(*desc)))
-                       return -EINVAL;
        }
 
        return 0;