[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220207103803.670073400@linuxfoundation.org>
Date: Mon, 7 Feb 2022 12:06:14 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Dan Carpenter <dan.carpenter@...cle.com>,
Leon Romanovsky <leonro@...dia.com>,
Bernard Metzler <bmt@...ich.ibm.com>,
Jason Gunthorpe <jgg@...dia.com>
Subject: [PATCH 5.15 041/110] RDMA/siw: Fix refcounting leak in siw_create_qp()
From: Dan Carpenter <dan.carpenter@...cle.com>
commit a75badebfdc0b3823054bedf112edb54d6357c75 upstream.
The atomic_inc() needs to be paired with an atomic_dec() on the error
path.
Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory")
Link: https://lore.kernel.org/r/20220118091104.GA11671@kili
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Reviewed-by: Leon Romanovsky <leonro@...dia.com>
Reviewed-by: Bernard Metzler <bmt@...ich.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@...dia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/infiniband/sw/siw/siw_verbs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -311,7 +311,8 @@ int siw_create_qp(struct ib_qp *ibqp, st
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");
Powered by blists - more mailing lists