]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/cm: Fix memory leak in ib_cm_insert_listen
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 21 Jun 2022 05:25:44 +0000 (09:25 +0400)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 24 Jun 2022 19:41:03 +0000 (16:41 -0300)
commitae5971fece92a506cd3f2cef13d1a20d252c7e36
treedd5408fe289a66d3806a1545019e81b0f7d2acb8
parentfb4db0802c3ca6fb2f8118d50e50a9b63d8b48c5
RDMA/cm: Fix memory leak in ib_cm_insert_listen

cm_alloc_id_priv() allocates resource for the cm_id_priv. When
cm_init_listen() fails it doesn't free it, leading to memory leak.

Add the missing error unwind.

Fixes: 485527c8a017 ("RDMA/cm: Simplify establishing a listen cm_id")
Link: https://lore.kernel.org/r/20220621052546.4821-1-linmq006@gmail.com
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/cm.c