From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bernard Metzler <bmt@zurich.ibm.com>,
Leon Romanovsky <leonro@nvidia.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
Gal Pressman <galpress@amazon.com>,
Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] RDMA/siw: fix refcounting leak in siw_create_qp()
Date: Tue, 18 Jan 2022 12:11:04 +0300 [thread overview]
Message-ID: <20220118091104.GA11671@kili> (raw)
The atomic_inc() needs to be paired with an atomic_dec() on the error
path.
Fixes: 514aee660df4 ("RDMA: Globally allocate and release QP memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/infiniband/sw/siw/siw_verbs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index a3dd2cb6d5c9..54ef367b074a 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -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");
--
2.20.1
next reply other threads:[~2022-01-18 9:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 9:11 Dan Carpenter [this message]
2022-01-18 9:56 ` [PATCH] RDMA/siw: fix refcounting leak in siw_create_qp() Leon Romanovsky
2022-01-18 11:38 ` Bernard Metzler
2022-01-28 16:40 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220118091104.GA11671@kili \
--to=dan.carpenter@oracle.com \
--cc=bmt@zurich.ibm.com \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=galpress@amazon.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.