From patchwork Mon Nov 16 19:23:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 84249 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64391A04DD; Mon, 16 Nov 2020 20:24:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A8408323E; Mon, 16 Nov 2020 20:23:59 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by dpdk.org (Postfix) with ESMTP id 2A5D731FC for ; Mon, 16 Nov 2020 20:23:57 +0100 (CET) Received: from localhost.localdomain (unknown [188.242.7.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 964497F600; Mon, 16 Nov 2020 22:23:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 964497F600 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1605554635; bh=x72W2f3EHIcsqnChSE9oJywfz6l7IGYuRJ1buH8CkWw=; h=From:To:Cc:Subject:Date; b=sQC1mTYEtONI/chUxSnPDAQsRCZ5h6UtSmpDaaRtW5fZas3BbDRq4rfae196cw3iZ 8aA4eimJqhCsTzRH6uXLAI6GGngn61JaR8ic253dLeo+bmSuK6EVa1dKQHssAMWyin Yl+ewMlgGGbEb3j2LkMB8yLz3pMX4OewzNRmw11s= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton Date: Mon, 16 Nov 2020 22:23:03 +0300 Message-Id: <20201116192303.14791-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/sfc: fix double free on encap. transfer flow rule path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Don't free the outer match spec by its pointer in the parsing context if it has already been tracked by an entry in the outer rule registry. Fixes: dadff137931c ("net/sfc: support encap flow items in transfer rules") Signed-off-by: Ivan Malov Acked-by: Andrew Rybchenko --- drivers/net/sfc/sfc_mae.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index c78a376a8..4ddfef556 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -1607,6 +1607,9 @@ sfc_mae_rule_process_outer(struct sfc_adapter *sa, } } + /* The spec has now been tracked by the outer rule entry. */ + ctx->match_spec_outer = NULL; + /* * Depending on whether we reuse an existing outer rule or create a * new one (see above), outer rule ID is either a valid value or @@ -1717,7 +1720,8 @@ sfc_mae_rule_encap_parse_fini(struct sfc_adapter *sa, if (ctx->encap_type == EFX_TUNNEL_PROTOCOL_NONE) return; - efx_mae_match_spec_fini(sa->nic, ctx->match_spec_outer); + if (ctx->match_spec_outer != NULL) + efx_mae_match_spec_fini(sa->nic, ctx->match_spec_outer); } int