Skip to content

Commit a75bade

Browse files
Dan Carpenterjgunthorpe
authored andcommitted
RDMA/siw: Fix refcounting leak in siw_create_qp()
The atomic_inc() needs to be paired with an atomic_dec() on the error path. Fixes: 514aee6 ("RDMA: Globally allocate and release QP memory") Link: https://lore.kernel.org/r/20220118091104.GA11671@kili Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 36e8169 commit a75bade

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/infiniband/sw/siw/siw_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
313313

314314
if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
315315
siw_dbg(base_dev, "too many QP's\n");
316-
return -ENOMEM;
316+
rv = -ENOMEM;
317+
goto err_atomic;
317318
}
318319
if (attrs->qp_type != IB_QPT_RC) {
319320
siw_dbg(base_dev, "only RC QP's supported\n");

0 commit comments

Comments
 (0)