Skip to content

Commit 2b026a2

Browse files
Tariq Toukangregkh
authored andcommitted
IB/uverbs: Fix leak of XRC target QPs
commit 5b810a242c28e1d8d64d718cebe75b79d86a0b2d upstream. The real QP is destroyed in case of the ref count reaches zero, but for XRC target QPs this call was missed and caused to QP leaks. Let's call to destroy for all flows. Fixes: 0e0ec7e ('RDMA/core: Export ib_open_qp() to share XRC...') Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Noa Osherovich <noaos@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent eba83a8 commit 2b026a2

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/infiniband/core/uverbs_main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,9 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
244244
container_of(uobj, struct ib_uqp_object, uevent.uobject);
245245

246246
idr_remove_uobj(&ib_uverbs_qp_idr, uobj);
247-
if (qp != qp->real_qp) {
248-
ib_close_qp(qp);
249-
} else {
247+
if (qp == qp->real_qp)
250248
ib_uverbs_detach_umcast(qp, uqp);
251-
ib_destroy_qp(qp);
252-
}
249+
ib_destroy_qp(qp);
253250
ib_uverbs_release_uevent(file, &uqp->uevent);
254251
kfree(uqp);
255252
}

0 commit comments

Comments
 (0)