Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3692284ybv; Mon, 10 Feb 2020 04:48:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzQrlTaotd1GEpC5MOIXEvgrzuZv9qhwZaiK4OFJ/WBJINY4xkeOrXFom5YMlvwLEYVjK1v X-Received: by 2002:a9d:5a09:: with SMTP id v9mr886183oth.214.1581338927829; Mon, 10 Feb 2020 04:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338927; cv=none; d=google.com; s=arc-20160816; b=iKwXwmtgDhiuNyjGmBjZBvuMQhxhnk1ZNDwLC2/H3yStyVwPFYtrMcjw+74OqX3Ab4 vP6ncLyRuJI+uSk262MeQwHzJxJFl2SsAbvqVtAVNB84qVqQUcXHaBB62n9HP0+uJNv4 N9xZh+EkkPPX3nl+fbOEK8AapDcLWU4YcMLDUQdVq5QnkqlUCRYfj9aH9eAGSiGLyZaa 4EbFke+OLdn2TsCyzwKx1+z7XNPK+IP2h7Fy8pczi4C/dd4CrIpVwURyjoIP4tk9Hz4z L34j6KGp7yIAOt6b9CxJ8CBhmAnSoNVIuWvwb2QM4sHZxvhcnBe4KiBhg8GvYp35gzUP bVlw== 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=XT0+NrvGmtaUzWGfoZeV4eIUgkyK81OHCT0OiPqYq58=; b=jdrl1JBa5ooQ5V52eWoASwpnUwd/2SMEWxm5TYDExKl+B6lQsBDR20NNDrL27QP+vA ldXKY1TqEv7YqH4ELXUs9tRMT4Clpybf4JGtefJ2bO6aRYTrLrNqlv/1u2fivIUjDSlX EuliH43x4kW+gFV5dazunNCn2s9X5yWxubSb/cdueliTRy5+iZVfkxAIs30gld77Spbk JUVZ58ueMSbhPcxJJzR/JoccyxBc9D7pd5YHvxCUHzgAGGAuzWA7KXk4Qm25l5s1Rt9P bVZkTrBttrTPRCFG04hKWNC7NUSsydlqaqz57xF4cek83b2lCuyd+C/UcKi+HNuNUfF3 X9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iLy/TY4y"; 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 s11si133876otd.245.2020.02.10.04.48.36; Mon, 10 Feb 2020 04:48: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="iLy/TY4y"; 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 S1730904AbgBJMrD (ORCPT + 99 others); Mon, 10 Feb 2020 07:47:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:45390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729871AbgBJMl6 (ORCPT ); Mon, 10 Feb 2020 07:41:58 -0500 Received: from localhost (unknown [209.37.97.194]) (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 7348F20838; Mon, 10 Feb 2020 12:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338517; bh=uljqPqiCh9mIDUXbcxpDmRov9qBN5mVQOrsz0zc6BT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iLy/TY4yxQ41UradKQQx+udzUax/akBw6KBK4odvDtvXD97mR+QYH0Ewy8UC5EJz1 N6X1kCm2UI99075rfbh0fdy5/Q4uwoQpSYVBX1Jugw2SaTHt03xUoqoy45f9v01Kwe 6FtJ8MHm71pph14vQRlO4kI7nViN5QDYnOsFTR24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raed Salem , Boris Pismenny , Saeed Mahameed Subject: [PATCH 5.5 327/367] net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx Date: Mon, 10 Feb 2020 04:34:00 -0800 Message-Id: <20200210122453.113396505@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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: Raed Salem [ Upstream commit 08db2cf577487f5123aebcc2f913e0b8a2c14b43 ] SA context is allocated at mlx5_fpga_ipsec_create_sa_ctx, however the counterpart mlx5_fpga_ipsec_delete_sa_ctx function nullifies sa_ctx pointer without freeing the memory allocated, hence the memory leak. Fix by free SA context when the SA is released. Fixes: d6c4f0298cec ("net/mlx5: Refactor accel IPSec code") Signed-off-by: Raed Salem Reviewed-by: Boris Pismenny Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c @@ -850,6 +850,7 @@ void mlx5_fpga_ipsec_delete_sa_ctx(void mutex_lock(&fpga_xfrm->lock); if (!--fpga_xfrm->num_rules) { mlx5_fpga_ipsec_release_sa_ctx(fpga_xfrm->sa_ctx); + kfree(fpga_xfrm->sa_ctx); fpga_xfrm->sa_ctx = NULL; } mutex_unlock(&fpga_xfrm->lock);