aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/cma.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 3982b81d33cf..9ae4f3a67c70 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -874,23 +874,25 @@ static struct rdma_id_private *cma_new_id(struct rdma_cm_id *listen_id,
874 __u16 port; 874 __u16 port;
875 u8 ip_ver; 875 u8 ip_ver;
876 876
877 if (cma_get_net_info(ib_event->private_data, listen_id->ps,
878 &ip_ver, &port, &src, &dst))
879 goto err;
880
877 id = rdma_create_id(listen_id->event_handler, listen_id->context, 881 id = rdma_create_id(listen_id->event_handler, listen_id->context,
878 listen_id->ps); 882 listen_id->ps);
879 if (IS_ERR(id)) 883 if (IS_ERR(id))
880 return NULL; 884 goto err;
885
886 cma_save_net_info(&id->route.addr, &listen_id->route.addr,
887 ip_ver, port, src, dst);
881 888
882 rt = &id->route; 889 rt = &id->route;
883 rt->num_paths = ib_event->param.req_rcvd.alternate_path ? 2 : 1; 890 rt->num_paths = ib_event->param.req_rcvd.alternate_path ? 2 : 1;
884 rt->path_rec = kmalloc(sizeof *rt->path_rec * rt->num_paths, GFP_KERNEL); 891 rt->path_rec = kmalloc(sizeof *rt->path_rec * rt->num_paths,
892 GFP_KERNEL);
885 if (!rt->path_rec) 893 if (!rt->path_rec)
886 goto err; 894 goto destroy_id;
887 895
888 if (cma_get_net_info(ib_event->private_data, listen_id->ps,
889 &ip_ver, &port, &src, &dst))
890 goto err;
891
892 cma_save_net_info(&id->route.addr, &listen_id->route.addr,
893 ip_ver, port, src, dst);
894 rt->path_rec[0] = *ib_event->param.req_rcvd.primary_path; 896 rt->path_rec[0] = *ib_event->param.req_rcvd.primary_path;
895 if (rt->num_paths == 2) 897 if (rt->num_paths == 2)
896 rt->path_rec[1] = *ib_event->param.req_rcvd.alternate_path; 898 rt->path_rec[1] = *ib_event->param.req_rcvd.alternate_path;
@@ -903,8 +905,10 @@ static struct rdma_id_private *cma_new_id(struct rdma_cm_id *listen_id,
903 id_priv = container_of(id, struct rdma_id_private, id); 905 id_priv = container_of(id, struct rdma_id_private, id);
904 id_priv->state = CMA_CONNECT; 906 id_priv->state = CMA_CONNECT;
905 return id_priv; 907 return id_priv;
906err: 908
909destroy_id:
907 rdma_destroy_id(id); 910 rdma_destroy_id(id);
911err:
908 return NULL; 912 return NULL;
909} 913}
910 914