Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2459543imd; Fri, 2 Nov 2018 11:46:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5fiszdv0eIeORRgl+OjdjV3+r8iKV44+4yDiGUFgu2f0voPGMXlIaj6ce/9wtdEKuEI78VV X-Received: by 2002:a62:8a91:: with SMTP id o17-v6mr12968917pfk.184.1541184398412; Fri, 02 Nov 2018 11:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184398; cv=none; d=google.com; s=arc-20160816; b=Uy1ljBTfg7l/gY6beYGWViu4Ci0LquxSn7dsd+fT4YG+EjGC0T+of+5i6miUOPaSnY YQG8E5cmbpDYnTuTuZFHCnQF+SuLnqAooAs3VeqfvoPAJCHIWEKYzkX2li7m5cTqiMAL hYv9CcOafiF9EC0vYAIuWZPy0XHNomPOXS/Iu/Tknw8WNOgza+0KrLBULsFFuEIi1fZP aOA1h44HHDYR/5aFDlXz2WeXJzbRvJ8kpAUdNTQdICJ2koLrZSvc/tF2IeTLdKcIz6aw yLfzkqq8jvb2nX6nlY1v4K5HZraeGkPDATsN/dPFm9rICnVVB9C8dBbrSQoOMfd+izVl n06w== 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=guKUR4ZdABG3jT2df5vFz5+HgOcKVHkn/MzUQOALPc0=; b=Jx7/yKD15SpLvZDMtBfooMU+FtI29SFF0HDuR1Iu/VxYaajKRbvi7aLmoCHEoA4XyW QDQRw88fyNkx7dPGPjYr+d+1VVQ+ScF6/XzI2NqKyPc5Zms9DNMX11NPlqNDTwMYuqxC ytiBClqaaxLEa8qXGsLhE5XEZpR7JBjyf3WjTdgd6fTNWguGinLcETRppoGxWHoGk8q2 iaQtqlTUQzIvTkkYGwN0yyHz/e/ciJC8DCZ+c3HYSNGEzRgce/ECpzuC7KaPI5qozBUC 26JUppFRW3VqA5WSHSsBPk92ECkU6Uc7Cy585NvdDUCKd26HuXFMwladoqtIbC0pL7Tr dU3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CTzqRTiF; 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 v33-v6si32164699pga.450.2018.11.02.11.46.23; Fri, 02 Nov 2018 11:46:38 -0700 (PDT) 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=CTzqRTiF; 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 S1730192AbeKCDxd (ORCPT + 99 others); Fri, 2 Nov 2018 23:53:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:49194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729726AbeKCDxc (ORCPT ); Fri, 2 Nov 2018 23:53:32 -0400 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 ACDBA2084A; Fri, 2 Nov 2018 18:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184319; bh=lRPzoeZ4eCJf6uQ/H9CWi259RBT00djbNBBO+HCbF9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CTzqRTiFXVl5vG5GzE0afky/AasQMX6Dv/1kuVBrrgqHhM/0ftXQIYch8eLmk0vkZ Jc3Z+IRfVEnzQr423yVEkPCGweG6rV07ykkO8CFrhDYdqhcw9ttb2Ay4J7ZHqd3rSd x+Z+Si+k4uXzqmqVL3PWn9MVQ+Z54lqc0swG7gT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Talat Batheesh , Or Gerlitz , Tariq Toukan , Saeed Mahameed Subject: [PATCH 4.18 134/150] net/mlx5: Fix memory leak when setting fpga ipsec caps Date: Fri, 2 Nov 2018 19:34:56 +0100 Message-Id: <20181102182912.006225198@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Talat Batheesh [ Upstream commit fd7e848077c1a466b9187537adce16658f7cb94b ] Allocated memory for context should be freed once finished working with it. Fixes: d6c4f0298cec ("net/mlx5: Refactor accel IPSec code") Signed-off-by: Talat Batheesh Reviewed-by: Or Gerlitz Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c @@ -245,7 +245,7 @@ static void *mlx5_fpga_ipsec_cmd_exec(st return ERR_PTR(res); } - /* Context will be freed by wait func after completion */ + /* Context should be freed by the caller after completion. */ return context; } @@ -418,10 +418,8 @@ static int mlx5_fpga_ipsec_set_caps(stru cmd.cmd = htonl(MLX5_FPGA_IPSEC_CMD_OP_SET_CAP); cmd.flags = htonl(flags); context = mlx5_fpga_ipsec_cmd_exec(mdev, &cmd, sizeof(cmd)); - if (IS_ERR(context)) { - err = PTR_ERR(context); - goto out; - } + if (IS_ERR(context)) + return PTR_ERR(context); err = mlx5_fpga_ipsec_cmd_wait(context); if (err) @@ -435,6 +433,7 @@ static int mlx5_fpga_ipsec_set_caps(stru } out: + kfree(context); return err; }