linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-rc 4/4] IB/rxe: Fix kmem_cache leak
Date: Mon,  5 Sep 2016 15:09:19 +0300	[thread overview]
Message-ID: <1473077359-11546-5-git-send-email-leon@kernel.org> (raw)
In-Reply-To: <1473077359-11546-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Decrement qp reference when handling error path
in completer to prevent kmem_cache leak.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Yonatan Cohen <yonatanc-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/sw/rxe/rxe_comp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
index 36f67de..1c59ef2 100644
--- a/drivers/infiniband/sw/rxe/rxe_comp.c
+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
@@ -689,7 +689,14 @@ int rxe_completer(void *arg)
 					qp->req.need_retry = 1;
 					rxe_run_task(&qp->req.task, 1);
 				}
+
+				if (pkt) {
+					rxe_drop_ref(pkt->qp);
+					kfree_skb(skb);
+				}
+
 				goto exit;
+
 			} else {
 				wqe->status = IB_WC_RETRY_EXC_ERR;
 				state = COMPST_ERROR;
@@ -716,6 +723,12 @@ int rxe_completer(void *arg)
 		case COMPST_ERROR:
 			do_complete(qp, wqe);
 			rxe_qp_error(qp);
+
+			if (pkt) {
+				rxe_drop_ref(pkt->qp);
+				kfree_skb(skb);
+			}
+
 			goto exit;
 		}
 	}
-- 
2.7.4

--
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-09-05 12:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 12:09 [PATCH rdma-rc 0/4] RXE fixes for 4.8 Leon Romanovsky
     [not found] ` <1473077359-11546-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-09-05 12:09   ` [PATCH rdma-rc 1/4] IB/rxe: Fix kernel panic in udp_setup_tunnel Leon Romanovsky
     [not found]     ` <1473077359-11546-2-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-09-05 13:24       ` Yuval Shaia
     [not found]         ` <20160905132402.GA14607-Hxa29pjIrETlQW142y8m19+IiqhCXseY@public.gmane.org>
2016-09-05 14:03           ` Leon Romanovsky
2016-09-05 13:32       ` Doug Ledford
     [not found]         ` <e0399c1c-567c-4996-a454-4ebefbe6e665-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-05 14:04           ` Leon Romanovsky
     [not found]     ` <CAJ3xEMiBpGRy-JGuJ=P4eUF5zyz+2bm43F-jqPHtwm=3Uz9YYA@mail.gmail.com>
     [not found]       ` <CAJ3xEMiBpGRy-JGuJ=P4eUF5zyz+2bm43F-jqPHtwm=3Uz9YYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-05 19:21         ` Or Gerlitz
     [not found]           ` <CAJ3xEMidqQRMqP6u+SJSJVbq0weREAtAJN=eXsA_zzS0KnQ_7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-06  5:05             ` Leon Romanovsky
     [not found]               ` <20160906050518.GJ21847-2ukJVAZIZ/Y@public.gmane.org>
2016-09-06  6:06                 ` Or Gerlitz
     [not found]                   ` <CAJ3xEMiuuCTGiWbefAFLRYART4h8YypsvGqxT69cTpkbrDdx1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-06  8:59                     ` Leon Romanovsky
     [not found]                       ` <20160906085943.GL21847-2ukJVAZIZ/Y@public.gmane.org>
2016-09-06  9:21                         ` Or Gerlitz
2016-09-05 12:09   ` [PATCH rdma-rc 2/4] IB/rxe: Fix duplicate atomic request handling Leon Romanovsky
2016-09-05 12:09   ` [PATCH rdma-rc 3/4] IB/rxe: Fix race condition between requester and completer Leon Romanovsky
2016-09-05 12:09   ` Leon Romanovsky [this message]

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=1473077359-11546-5-git-send-email-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yonatanc-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).