linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Boyer <andrew.boyer-8PEkshWhKlo@public.gmane.org>
To: monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Andrew Boyer <andrew.boyer-8PEkshWhKlo@public.gmane.org>
Subject: [PATCH 7/7] IB/rxe: Fix ref leaks in duplicate_request() and rxe_create_qp()
Date: Fri, 18 Nov 2016 09:36:49 -0500	[thread overview]
Message-ID: <1479479809-10798-7-git-send-email-andrew.boyer@dell.com> (raw)
In-Reply-To: <1479479809-10798-1-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>

In duplicate_request(), a ref was added after the call to skb_clone().

In rxe_create_qp(), the udata->inlen error path needs to clean up the ref
added by rxe_alloc().

Signed-off-by: Andrew Boyer <andrew.boyer-8PEkshWhKlo@public.gmane.org>
---
 drivers/infiniband/sw/rxe/rxe_resp.c  | 1 +
 drivers/infiniband/sw/rxe/rxe_verbs.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index a5e9ce3..8643797 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -1145,6 +1145,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
 					     pkt, skb_copy);
 			if (rc) {
 				pr_err("Failed resending result. This flow is not handled - skb ignored\n");
+				rxe_drop_ref(qp);
 				kfree_skb(skb_copy);
 				rc = RESPST_CLEANUP;
 				goto out;
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index de39b0a..071430c 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -564,7 +564,7 @@ static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd,
 	if (udata) {
 		if (udata->inlen) {
 			err = -EINVAL;
-			goto err1;
+			goto err2;
 		}
 		qp->is_user = 1;
 	}
@@ -573,12 +573,13 @@ static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd,
 
 	err = rxe_qp_from_init(rxe, qp, pd, init, udata, ibpd);
 	if (err)
-		goto err2;
+		goto err3;
 
 	return &qp->ibqp;
 
-err2:
+err3:
 	rxe_drop_index(qp);
+err2:
 	rxe_drop_ref(qp);
 err1:
 	return ERR_PTR(err);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-11-18 14:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 14:36 [PATCH 1/7] IB/rxe: Allocate enough space for an IPv6 addr Andrew Boyer
     [not found] ` <1479479809-10798-1-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-18 14:36   ` [PATCH 2/7] IB/rxe: Advance the consumer pointer before posting the CQE Andrew Boyer
     [not found]     ` <1479479809-10798-2-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-22 15:24       ` Yonatan Cohen
2016-11-18 14:36   ` [PATCH 3/7] IB/rxe: Don't update the response PSN unless it's going forwards Andrew Boyer
     [not found]     ` <1479479809-10798-3-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-23 15:04       ` Yonatan Cohen
2016-11-18 14:36   ` [PATCH 4/7] IB/rxe: Unblock loopback by moving skb_out increment Andrew Boyer
     [not found]     ` <1479479809-10798-4-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-22 16:13       ` Moni Shoua
2016-11-18 14:36   ` [PATCH 5/7] IB/rxe: Add support for zero-byte operations Andrew Boyer
     [not found]     ` <1479479809-10798-5-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-23 15:04       ` Moni Shoua
2016-11-18 14:36   ` [PATCH 6/7] IB/rxe: Avoid missed completions in the CM/MAD Andrew Boyer
     [not found]     ` <1479479809-10798-6-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-22 17:14       ` Moni Shoua
2016-11-18 14:36   ` Andrew Boyer [this message]
     [not found]     ` <1479479809-10798-7-git-send-email-andrew.boyer-8PEkshWhKlo@public.gmane.org>
2016-11-23 16:00       ` [PATCH 7/7] IB/rxe: Fix ref leaks in duplicate_request() and rxe_create_qp() Moni Shoua
2016-11-22 15:21   ` [PATCH 1/7] IB/rxe: Allocate enough space for an IPv6 addr Yonatan Cohen
     [not found]     ` <975a89bc-033e-14ab-72f2-4244c0205e59-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-11-22 23:28       ` Bart Van Assche
2016-11-22 22:11   ` Bart Van Assche

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=1479479809-10798-7-git-send-email-andrew.boyer@dell.com \
    --to=andrew.boyer-8pekshwhklo@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).