From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f54.google.com ([209.85.221.54]:34922 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbeKZHJT (ORCPT ); Mon, 26 Nov 2018 02:09:19 -0500 Received: by mail-wr1-f54.google.com with SMTP id 96so16815724wrb.2 for ; Sun, 25 Nov 2018 12:17:27 -0800 (PST) Date: Sun, 25 Nov 2018 20:17:24 +0000 From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: stable@vger.kernel.org, Doug Ledford , Shiraz Saleem , Mustafa Ismail Subject: request for 4.14-stable: 5a7189d529cd ("i40iw: Fix memory leak in error path of create QP") Message-ID: <20181125201724.tl364hxiv2ewtv3f@debian> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vodpnucz5owdifnn" Content-Disposition: inline Sender: stable-owner@vger.kernel.org List-ID: --vodpnucz5owdifnn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Greg, This was not marked for stable but seems it should be in stable. Please apply to your queue of 4.14-stable. -- Regards Sudip --vodpnucz5owdifnn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-i40iw-Fix-memory-leak-in-error-path-of-create-QP.patch" >>From 254631e90437549753645125a9effb7bfe5e42bb Mon Sep 17 00:00:00 2001 From: Mustafa Ismail Date: Mon, 7 May 2018 12:52:17 -0500 Subject: [PATCH] i40iw: Fix memory leak in error path of create QP commit 5a7189d529cd146cd5838af97b32fcac4122b471 upstream If i40iw_allocate_dma_mem fails when creating a QP, the memory allocated for the QP structure using kzalloc is not freed because iwqp->allocated_buffer is used to free the memory and it is not setup until later. Fix this by setting iwqp->allocated_buffer before allocating the dma memory. Fixes: d37498417947 ("i40iw: add files for iwarp interface") Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Doug Ledford Signed-off-by: Sudip Mukherjee --- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 39398dd074d6..c1021b4afb41 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -631,6 +631,7 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, return ERR_PTR(-ENOMEM); iwqp = (struct i40iw_qp *)mem; + iwqp->allocated_buffer = mem; qp = &iwqp->sc_qp; qp->back_qp = (void *)iwqp; qp->push_idx = I40IW_INVALID_PUSH_PAGE_INDEX; @@ -659,7 +660,6 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, goto error; } - iwqp->allocated_buffer = mem; iwqp->iwdev = iwdev; iwqp->iwpd = iwpd; iwqp->ibqp.qp_num = qp_num; -- 2.11.0 --vodpnucz5owdifnn--