Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6550179ybx; Mon, 11 Nov 2019 10:47:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwmrfGKyNWTyHI8y2CZATxX5mgl0REyfP2jDG2TWRsFJ2Wk9f/nBR46OkfP5GfWUc+QE45Z X-Received: by 2002:a17:906:53c7:: with SMTP id p7mr23742229ejo.88.1573498067061; Mon, 11 Nov 2019 10:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573498067; cv=none; d=google.com; s=arc-20160816; b=KNTXzQdFDle/Ys0WpWZcxUCpKjj4AgQ1T2OEEith39X5s04U0v2Z5T0+UDyAxW72aH 9cTqv4qpL+mzH6t4IMkDuIH/ahJSz96W+9M+1gXeSAaJuGnxzrrXF2RGK3egbKb4AuZJ P0FMUiH1khxZg0jbVSfvnSVydSJva+JwqdIzOb/RrkAhurwqPlav+me6jmijlmHzuocX /jxKu9UFon3k2QrmqV6ycJ4r/fz4ONtGrbIEgQ73N9yu7dYdTlh+1o4vqXJj/4jumM/s c1/ahDihPnPu9S+Idnkd8/EDHUuh+csDSxhAa32oRSptrA+DEJ/RKs9sBzRssfSIG1dG VKrQ== 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=jKd+bgCsJrF6G8oY6b3plWYopnPKh2GCBNjD3sphONI=; b=uqqX5dd4qFJqbDxQeNaVEekGOdI3xIZWpuoElHWSWV+6WaRrIyVXF26yVaS22P5vpv iqWeb42HC6fH+KpDhzXXMAsuEXk+U2abHCqrtQpR91h9x8aj8X4Kr2I8SSxmRHnSTsy6 QarV2ZJEZRfovbBkjhswxpX2L4Akz1KUqLPrwnN7FEFLGFjrM69KtIKivdjny8oLtOg3 zd63LnwPcL/GVN+yHC6fXXGBFY7Z3CoZVpxnv+oqi0nNEq2JjWCNwPFF8ejjUfaG/Km+ S4Awolaf1TRFwxZ7nNPjGG0kvaRo8kZhYc1jpoC9MhbzNgR6/eieKtRqV/7bIUw+u5Aa KLfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EMZ0eugV; 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 l20si10348830edv.282.2019.11.11.10.47.23; Mon, 11 Nov 2019 10:47:47 -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=EMZ0eugV; 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 S1727031AbfKKSoq (ORCPT + 99 others); Mon, 11 Nov 2019 13:44:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:36450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729749AbfKKSom (ORCPT ); Mon, 11 Nov 2019 13:44:42 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 46898204FD; Mon, 11 Nov 2019 18:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497881; bh=VkUJ9Gsze1TFv8GHo1eZ9XvY5w9VauaoEJVkzxwl9SM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMZ0eugVoycAUodNdNECkQILMI0J+aXhIMSZyfhThzQJFHmPyvmhkGtHxleJ1q9Zq 4I2EdAFbYh8P45uK+nMZg05JeuNrIk9z/dSqFRTwaa/FGidnWOQ8nTn4lyLw3xpeyD kayFXtXyTtsRB7mYyJBgGyiqKq6L27epSk2/Vcy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Saeed Mahameed , Sasha Levin Subject: [PATCH 4.19 078/125] net/mlx5: prevent memory leak in mlx5_fpga_conn_create_cq Date: Mon, 11 Nov 2019 19:28:37 +0100 Message-Id: <20191111181450.548753263@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Navid Emamdoost [ Upstream commit c8c2a057fdc7de1cd16f4baa51425b932a42eb39 ] In mlx5_fpga_conn_create_cq if mlx5_vector2eqn fails the allocated memory should be released. Fixes: 537a50574175 ("net/mlx5: FPGA, Add high-speed connection routines") Signed-off-by: Navid Emamdoost Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c index 8ca1d1949d930..d8d0b6bd5c5ae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c @@ -462,8 +462,10 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size) } err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn); - if (err) + if (err) { + kvfree(in); goto err_cqwq; + } cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context); MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size)); -- 2.20.1