ret = ib_find_pkey(target->srp_host->srp_dev->dev,
                           target->srp_host->port,
-                          be16_to_cpu(target->path.pkey),
+                          be16_to_cpu(target->pkey),
                           &attr->pkey_index);
        if (ret)
                goto out;
        if (target->cm_id)
                ib_destroy_cm_id(target->cm_id);
        target->cm_id = new_cm_id;
+       target->path.sgid = target->sgid;
+       target->path.dgid = target->orig_dgid;
+       target->path.pkey = target->pkey;
+       target->path.service_id = target->service_id;
 
        return 0;
 }
         */
        if (target->io_class == SRP_REV10_IB_IO_CLASS) {
                memcpy(req->priv.initiator_port_id,
-                      &target->path.sgid.global.interface_id, 8);
+                      &target->sgid.global.interface_id, 8);
                memcpy(req->priv.initiator_port_id + 8,
                       &target->initiator_ext, 8);
                memcpy(req->priv.target_port_id,     &target->ioc_guid, 8);
                memcpy(req->priv.initiator_port_id,
                       &target->initiator_ext, 8);
                memcpy(req->priv.initiator_port_id + 8,
-                      &target->path.sgid.global.interface_id, 8);
+                      &target->sgid.global.interface_id, 8);
                memcpy(req->priv.target_port_id,     &target->id_ext, 8);
                memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8);
        }
                        else
                                shost_printk(KERN_WARNING, shost, PFX
                                             "SRP LOGIN from %pI6 to %pI6 REJECTED, reason 0x%08x\n",
-                                            target->path.sgid.raw,
-                                            target->orig_dgid, reason);
+                                            target->sgid.raw,
+                                            target->orig_dgid.raw, reason);
                } else
                        shost_printk(KERN_WARNING, shost,
                                     "  REJ reason: IB_CM_REJ_CONSUMER_DEFINED,"
 {
        struct srp_target_port *target = host_to_target(class_to_shost(dev));
 
-       return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey));
+       return sprintf(buf, "0x%04x\n", be16_to_cpu(target->pkey));
 }
 
 static ssize_t show_sgid(struct device *dev, struct device_attribute *attr,
 {
        struct srp_target_port *target = host_to_target(class_to_shost(dev));
 
-       return sprintf(buf, "%pI6\n", target->path.sgid.raw);
+       return sprintf(buf, "%pI6\n", target->sgid.raw);
 }
 
 static ssize_t show_dgid(struct device *dev, struct device_attribute *attr,
 {
        struct srp_target_port *target = host_to_target(class_to_shost(dev));
 
-       return sprintf(buf, "%pI6\n", target->orig_dgid);
+       return sprintf(buf, "%pI6\n", target->orig_dgid.raw);
 }
 
 static ssize_t show_req_lim(struct device *dev,
                        }
 
                        for (i = 0; i < 16; ++i) {
-                               strlcpy(dgid, p + i * 2, 3);
-                               target->path.dgid.raw[i] = simple_strtoul(dgid, NULL, 16);
+                               strlcpy(dgid, p + i * 2, sizeof(dgid));
+                               if (sscanf(dgid, "%hhx",
+                                          &target->orig_dgid.raw[i]) < 1) {
+                                       ret = -EINVAL;
+                                       kfree(p);
+                                       goto out;
+                               }
                        }
                        kfree(p);
-                       memcpy(target->orig_dgid, target->path.dgid.raw, 16);
                        break;
 
                case SRP_OPT_PKEY:
                                pr_warn("bad P_Key parameter '%s'\n", p);
                                goto out;
                        }
-                       target->path.pkey = cpu_to_be16(token);
+                       target->pkey = cpu_to_be16(token);
                        break;
 
                case SRP_OPT_SERVICE_ID:
                                goto out;
                        }
                        target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16));
-                       target->path.service_id = target->service_id;
                        kfree(p);
                        break;
 
        if (ret)
                goto err_free_mem;
 
-       ret = ib_query_gid(ibdev, host->port, 0, &target->path.sgid);
+       ret = ib_query_gid(ibdev, host->port, 0, &target->sgid);
        if (ret)
                goto err_free_mem;
 
                             "new target: id_ext %016llx ioc_guid %016llx pkey %04x service_id %016llx sgid %pI6 dgid %pI6\n",
                             be64_to_cpu(target->id_ext),
                             be64_to_cpu(target->ioc_guid),
-                            be16_to_cpu(target->path.pkey),
+                            be16_to_cpu(target->pkey),
                             be64_to_cpu(target->service_id),
-                            target->path.sgid.raw, target->orig_dgid);
+                            target->sgid.raw, target->orig_dgid.raw);
        }
 
        ret = count;