Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2101579iof; Tue, 7 Jun 2022 19:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWS7yso09UeUvXYduvYJQtx7wBMA0I/8UA1RWQD2gNW5uK7nsKPFduVrOHFFX2tuyFHWkT X-Received: by 2002:a63:8041:0:b0:3fc:6bdc:7320 with SMTP id j62-20020a638041000000b003fc6bdc7320mr27814546pgd.8.1654656474748; Tue, 07 Jun 2022 19:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656474; cv=none; d=google.com; s=arc-20160816; b=pSSOt64cVaqL6XBbv+lA+kdYapVrS0uFjh5qVbEkrz1us1GdnRvcblDsPeFcEvsFQm C7WzzedVWfWOStPgWYV/yzPvYx8TTua7c/+3coSk6Mr1BYGh5t70z5lAa633uWMxpCJq AyzLqz48XARjMzZDEvvvABdrg6Ul+BxdGrDwm8skQlW1rANYMKnr4+1JXTk0e7YBy44l Ywlo/AUQDR1YyNeaG3Pevg11AVGiX2JzYUtLq1LH1XVh3Fwa+ZE6xMxqpG4DE9Rhapuw GIS+4DoFSubRLmN28IVZqgXYbwnAdpw1K4QEEB7Q40bkKgvtb0eKyKHWPPjAUcF0q0XX aeVA== 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=M7BVitTjQtHNvl4l3IWfzIsJ0cLPCaC5uXBtY53kxRI=; b=yUZ5k6LuRvc4BvZeyFR/CKUCna9D4o5S88MReyEQAMsExQoc78H68Cqq+KWS/hyIUl p35bzGSzIAWROB1mvZhgciTdlWBt4aTWlbD07gqzRmrueZNXy1LQn8yUT1PBwJWmqPLc GbU0bTRgz+1NOQsCDZ37QGhkYKCnUqhm+8TbqSrWd/WXseOkipvoUHJPXT/ALgIy2Iva E3JlUbWEnn5buOJ3R/jm4/sCytTw+Pq7+95J07gIx0dGRPeI5x6gHay9gj2CwkkwvP78 NunXu6oDnJKWydO3JTgu6r7b37f2PC4nnMZlLGS7cu+cJx0lpDFRKv54DpF0R+I/AJ+x esYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z822kWUn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q28-20020a631f5c000000b003fd9834603csi12330428pgm.563.2022.06.07.19.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:47:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z822kWUn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B148274B45; Tue, 7 Jun 2022 18:18:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377960AbiFGWMF (ORCPT + 99 others); Tue, 7 Jun 2022 18:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379347AbiFGVJa (ORCPT ); Tue, 7 Jun 2022 17:09:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B473214428; Tue, 7 Jun 2022 11:51:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B0ACB82182; Tue, 7 Jun 2022 18:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DACFC385A2; Tue, 7 Jun 2022 18:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627882; bh=KIXhqxSYoKrP4kKBC0eYCNhdJSzSYEi5MBaoOve82dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z822kWUn45WJah36MuZSbXHpAb7GGoWePrMH6RZyxRo5TvzNes5rq2IQJRxQQJjGC 10R/1L7CnC5MNOsZ7COceuEGR3dP8lMONXoIV8cxkoA0GLyuUT8DOwneY8TQplTcFR dBSGahZwQhUtgujv61be9QgJom0NLzOCIIOsRXI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Bloch , Maor Gottlieb , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 127/879] net/mlx5: fs, delete the FTE when there are no rules attached to it Date: Tue, 7 Jun 2022 18:54:05 +0200 Message-Id: <20220607165006.388275159@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Bloch [ Upstream commit 7b0c6338597613f465d131bd939a51844a00455a ] When an FTE has no children is means all the rules where removed and the FTE can be deleted regardless of the dests_size value. While dests_size should be 0 when there are no children be extra careful not to leak memory or get firmware syndrome if the proper bookkeeping of dests_size wasn't done. Signed-off-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 3ad67e6b5586..89ba72e8d109 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -2071,16 +2071,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) down_write_ref_node(&fte->node, false); for (i = handle->num_rules - 1; i >= 0; i--) tree_remove_node(&handle->rule[i]->node, true); - if (fte->dests_size) { - if (fte->modify_mask) - modify_fte(fte); - up_write_ref_node(&fte->node, false); - } else if (list_empty(&fte->node.children)) { + if (list_empty(&fte->node.children)) { del_hw_fte(&fte->node); /* Avoid double call to del_hw_fte */ fte->node.del_hw_func = NULL; up_write_ref_node(&fte->node, false); tree_put_node(&fte->node, false); + } else if (fte->dests_size) { + if (fte->modify_mask) + modify_fte(fte); + up_write_ref_node(&fte->node, false); } else { up_write_ref_node(&fte->node, false); } -- 2.35.1