aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 768ba69f2fd9..993f0a8ff28f 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -244,7 +244,7 @@ struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
244 list_for_each_entry(device, &ig.device_list, ig_list) 244 list_for_each_entry(device, &ig.device_list, ig_list)
245 /* find if there's a match using the node GUID */ 245 /* find if there's a match using the node GUID */
246 if (device->ib_device->node_guid == cma_id->device->node_guid) 246 if (device->ib_device->node_guid == cma_id->device->node_guid)
247 goto out; 247 goto inc_refcnt;
248 248
249 device = kzalloc(sizeof *device, GFP_KERNEL); 249 device = kzalloc(sizeof *device, GFP_KERNEL);
250 if (device == NULL) 250 if (device == NULL)
@@ -260,9 +260,9 @@ struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
260 } 260 }
261 list_add(&device->ig_list, &ig.device_list); 261 list_add(&device->ig_list, &ig.device_list);
262 262
263out: 263inc_refcnt:
264 BUG_ON(device == NULL);
265 device->refcount++; 264 device->refcount++;
265out:
266 mutex_unlock(&ig.device_list_mutex); 266 mutex_unlock(&ig.device_list_mutex);
267 return device; 267 return device;
268} 268}
@@ -368,6 +368,12 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
368 int ret; 368 int ret;
369 369
370 device = iser_device_find_by_ib_device(cma_id); 370 device = iser_device_find_by_ib_device(cma_id);
371 if (!device) {
372 iser_err("device lookup/creation failed\n");
373 iser_connect_error(cma_id);
374 return;
375 }
376
371 ib_conn = (struct iser_conn *)cma_id->context; 377 ib_conn = (struct iser_conn *)cma_id->context;
372 ib_conn->device = device; 378 ib_conn->device = device;
373 379
@@ -376,7 +382,6 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
376 iser_err("resolve route failed: %d\n", ret); 382 iser_err("resolve route failed: %d\n", ret);
377 iser_connect_error(cma_id); 383 iser_connect_error(cma_id);
378 } 384 }
379 return;
380} 385}
381 386
382static void iser_route_handler(struct rdma_cm_id *cma_id) 387static void iser_route_handler(struct rdma_cm_id *cma_id)