Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2547688imu; Thu, 29 Nov 2018 06:43:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/WfEvqbu/nhQhEBX5PytyaubFv2/fai1tEP6S6okTA7OMvzXpaQyCamOP1x1uGb937Vuf5H X-Received: by 2002:aa7:8203:: with SMTP id k3mr1615639pfi.192.1543502597890; Thu, 29 Nov 2018 06:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502597; cv=none; d=google.com; s=arc-20160816; b=I7U0z2M/lG9E5f4ZqOP4KsBuhR94MD5JkImlvWz5S12uhEYPmHTOZnv86EDZoZ4R27 ykaHczMOx+JbHSi/LTpooPZWD1RpCy2b9RcCmgWki2v/41EQxIinc4/WJJNiWRcFLD+a tZl+2pEClJWEmPbz/J7Xza7WqjJhvDZQ1CkB0bgUVTiLz9v+v8QqhxL0g8fpjzDdTNqA gwkbhFtKYH85z0JGkiGuOsh6XnznQ8E1muhMzCMZo/eR+rWB6VXG7Ow2zX8nmI4T/fqd qEiGEgweAgPVoobGT8+nSVNs2Zu7o5h4tm/q/loaASLJLJ/OucD0ggeDCMX//YwvnmFA b/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8djLfVXrKPe4Ln5S4wj/hbUCAmGEaWlGaMbbjr8lxRQ=; b=tyZxdVmNLDweA9JMXqD4239k2wfrUEgjNfWLmFRedntkpEWKrLIPmRYp9We94NZDb6 6I08ASAEGCY0A6yCqEQqAsTXU/p98diIJCZrN/jR7On52RJizj3yes0EEAfU/2xIxXk8 NO0c6ZryAGC7QKdDXpaoo6s5ViRgWVIfoGcOVeFsk43VuEdKF7h5bB+Z+I16MSzccxTc p4HsgplikiGBQO3gXtyPXrWls8nc/1UT2nsHd7LVvKDkeEqlT5XihdaaYta6YEkHb5O2 iEDDdZ2gnELwZ5nbuxCaa/Znx80eFBkY0wewmf+u99rGhoixPN/O8RKX3Pvmj1gye2FN Xw4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V2exSSB1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si2447624pfb.152.2018.11.29.06.43.02; Thu, 29 Nov 2018 06:43:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V2exSSB1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388077AbeK3BeB (ORCPT + 99 others); Thu, 29 Nov 2018 20:34:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:34942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733011AbeK3BeA (ORCPT ); Thu, 29 Nov 2018 20:34:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C193921479; Thu, 29 Nov 2018 14:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501707; bh=M7s1uxl/NrpZkeKVL71UROH2AsK+TJqNW14MKoCxWQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2exSSB1g75sUxmH970cGJ41kmOhNmTe3nL+CXb3yE/w7xBZjcTkv1Mvw/xl0Z9NX n8eF4FZgO5BCgj8XIE9oKQyT9fyGOUlyLyegZu6wNOnGqEL46N76KZLNc2ewEWts4e VaLWtIwWOcsQsGjXTPHfSIfG0eKE6dpVRE6Rm2os= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mustafa Ismail , Shiraz Saleem , Doug Ledford , Sudip Mukherjee Subject: [PATCH 4.14 083/100] i40iw: Fix memory leak in error path of create QP Date: Thu, 29 Nov 2018 15:12:53 +0100 Message-Id: <20181129140105.959505095@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mustafa Ismail 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 Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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(str 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(str goto error; } - iwqp->allocated_buffer = mem; iwqp->iwdev = iwdev; iwqp->iwpd = iwpd; iwqp->ibqp.qp_num = qp_num;