Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3868542pxb; Tue, 17 Nov 2020 05:48:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTwc9K9xHpSrdK5yJlX3GMaRofFPBgVO3oVXTyQY5BcWsEiJ3q73KaYS1KPKdBvCpDUPAX X-Received: by 2002:aa7:c30e:: with SMTP id l14mr21037891edq.315.1605620925435; Tue, 17 Nov 2020 05:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620925; cv=none; d=google.com; s=arc-20160816; b=jrDlbiSkC2YRswNFrenjuGZjuxIGAfx4D+PaaudT088fO1LjBHFKRzZigen1LLTQLe wWIsCGfmxuGnYUw5YPRB6gvpX3/4U1DjNQMPBZwP6Vc+a8URcA+SvN/dqKacr0UDt4zf nYhNyuhbNn1gOmsjCoFsQi3yPsl4LciLGJWD6m/AaUZ6EnVj41J1BlMdHok8PQAcrIPd H7q+DjevNl6gp0Nl0jbzrs1tly777bYjrk/2+0x1ZpskMDdv+5pnMAVF3uMbn6wFtfVf bBUN/5zxExMAQSUZ1qX1pyNO/9RFBrOtOwUQGPPxKDCyM+8MhiO16QssEIdoo80dv4g8 qOEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v/Z1oAAGdAS9/8bouOFGdrgrqgAz/JwHRxOVg14aarQ=; b=u4iT3x+Wh2g7C5bk8VgnQLZ/QMT0H6SX12pOlLRmWDFAKO6MDhG7lbHfGKTmVLogSo 35wDDi/SMf6MgJplVm5fmC3A/1ux51pkTGPZwOYpXG5LvjgwKE5jE4Hh1lN3NBk8KHHH qbRQWbzvthmjRmpnJM80OkBbiXccE7GkOJCH4iYAvS4kR1w9HJXCR5rsNVhDIXngjWEY xIGwZMTOLGYvN8mcGTQc3E3xgnazgrmhQJ1/Cna9UkDNjzps1Y0NWQS303LNOUB09+ue ngmcDOwYhYdHVNNPJfqXHgSeYLCg6hTGmmT16JuunGlBCTS2nwB3QrBmfFl2wKnLbrt1 ehaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ImQE/HOS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv12si13084308ejb.613.2020.11.17.05.48.22; Tue, 17 Nov 2020 05:48:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ImQE/HOS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732598AbgKQNhO (ORCPT + 99 others); Tue, 17 Nov 2020 08:37:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:47420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732590AbgKQNg2 (ORCPT ); Tue, 17 Nov 2020 08:36:28 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8A3C820780; Tue, 17 Nov 2020 13:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620188; bh=H21UDbvjmEtYzVfm+j2/I6W7vViXbI6wL+dUmYixjDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ImQE/HOSY4LQjojQ9GYJi5X/3IIa0Mp9SHTTKc2OvbQliBe4gAy6JYo1sNJOku00V U+aTnXp1lZRwtPesEOBx5NKMy7iqTqc4mEeqcqwceHWSTk26pRTahjW7lM2MN36dGh QbSClvLZDyNuCw1VFnyp6qXvTjYiy5x6uCA4z/4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Dickman , Paul Blakey , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.9 136/255] net/mlx5e: Fix modify header actions memory leak Date: Tue, 17 Nov 2020 14:04:36 +0100 Message-Id: <20201117122145.559907072@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maor Dickman [ Upstream commit e68e28b4a9d71261e3f8fd05a72d6cf0b443a493 ] Modify header actions are allocated during parse tc actions and only freed during the flow creation, however, on error flow the allocated memory is wrongly unfreed. Fix this by calling dealloc_mod_hdr_actions in __mlx5e_add_fdb_flow and mlx5e_add_nic_flow error flow. Fixes: d7e75a325cb2 ("net/mlx5e: Add offloading of E-Switch TC pedit (header re-write) actions") Fixes: 2f4fe4cab073 ("net/mlx5e: Add offloading of NIC TC pedit (header re-write) actions") Signed-off-by: Maor Dickman Reviewed-by: Paul Blakey Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 1c93f92d9210a..44947b054dc4c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -4430,6 +4430,7 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv, return flow; err_free: + dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); mlx5e_flow_put(priv, flow); out: return ERR_PTR(err); @@ -4564,6 +4565,7 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv, return 0; err_free: + dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); mlx5e_flow_put(priv, flow); kvfree(parse_attr); out: -- 2.27.0