Skip to content

Commit be68819

Browse files
haggaiedledford
authored andcommitted
IB/cma: Fix net_dev reference leak with failed requests
When no matching listening ID is found for a given request, the net_dev that was used to find the request isn't released. Fixes: 0b3ca76 ("IB/cma: Use found net_dev for passive connections") Signed-off-by: Haggai Eran <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 73fec7f commit be68819

File tree

1 file changed

+4
-0
lines changed
  • drivers/infiniband/core

1 file changed

+4
-0
lines changed

drivers/infiniband/core/cma.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,10 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
13021302
bind_list = cma_ps_find(rdma_ps_from_service_id(req.service_id),
13031303
cma_port_from_service_id(req.service_id));
13041304
id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev);
1305+
if (IS_ERR(id_priv)) {
1306+
dev_put(*net_dev);
1307+
*net_dev = NULL;
1308+
}
13051309

13061310
return id_priv;
13071311
}

0 commit comments

Comments
 (0)