forked from Minki/linux
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: 514aee660d
("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>
This commit is contained in:
parent
36e8169ec9
commit
a75badebfd
@ -313,7 +313,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs,
|
||||
|
||||
if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
|
||||
siw_dbg(base_dev, "too many QP's\n");
|
||||
return -ENOMEM;
|
||||
rv = -ENOMEM;
|
||||
goto err_atomic;
|
||||
}
|
||||
if (attrs->qp_type != IB_QPT_RC) {
|
||||
siw_dbg(base_dev, "only RC QP's supported\n");
|
||||
|
Loading…
Reference in New Issue
Block a user