Skip to content

Commit 8b00914

Browse files
matanb10jgunthorpe
authored andcommitted
IB/core: Fix memory leak in cm_req_handler error flows
In cm_req_handler error flows, sometimes cm_id_priv->timewait_info isn't free'd. Signed-off-by: Matan Barak <[email protected]> Signed-off-by: Mukesh Kacker <[email protected]> Signed-off-by: Daniel Jurgens <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 7baaa49 commit 8b00914

File tree

1 file changed

+3
-2
lines changed
  • drivers/infiniband/core

1 file changed

+3
-2
lines changed

drivers/infiniband/core/cm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,8 +1876,7 @@ static int cm_req_handler(struct cm_work *work)
18761876
listen_cm_id_priv = cm_match_req(work, cm_id_priv);
18771877
if (!listen_cm_id_priv) {
18781878
ret = -EINVAL;
1879-
kfree(cm_id_priv->timewait_info);
1880-
goto destroy;
1879+
goto free_timeinfo;
18811880
}
18821881

18831882
cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
@@ -1979,6 +1978,8 @@ static int cm_req_handler(struct cm_work *work)
19791978
rejected:
19801979
atomic_dec(&cm_id_priv->refcount);
19811980
cm_deref_id(listen_cm_id_priv);
1981+
free_timeinfo:
1982+
kfree(cm_id_priv->timewait_info);
19821983
destroy:
19831984
ib_destroy_cm_id(cm_id);
19841985
return ret;

0 commit comments

Comments
 (0)