In the alloc_ep_skb_list() failure path, the c4iw_put_ep() is incorrectly used instead of the kfree(). Since the child_ep's reference count hasn't been properly established at this point, the c4iw_put_ep() won't actually free the memory, resulting in permanent memory leak.
Fix by releasing child_ep correctly in the fail path.
Fixes: 4a740838bf44 ("RDMA/iw_cxgb4: Low resource fixes for connection manager") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang vulab@iscas.ac.cn --- drivers/infiniband/hw/cxgb4/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b3b45c49077d..a09eeb48775f 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -2665,7 +2665,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) } goto out; fail: - c4iw_put_ep(&child_ep->com); + kfree(child_ep); reject: reject_cr(dev, hwtid, skb); out: