Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2155300iof; Tue, 7 Jun 2022 21:36:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUWPNM77gRuqNuMKUzY7Z7wd8EXqEnFp2XbggkVijD0Glp93jsF1aH89B4TsF1v0vW6XKx X-Received: by 2002:a62:be14:0:b0:505:a43b:cf6e with SMTP id l20-20020a62be14000000b00505a43bcf6emr100002090pff.33.1654662984001; Tue, 07 Jun 2022 21:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662983; cv=none; d=google.com; s=arc-20160816; b=g7MEUj/+7vTNBDXccDO8Zeqvp50Lnwd6s8mxYBU++ZCuacOBHrQAyhBHhcqWTwpOKp e9lX1GPG2JcWED2sNB10LVsMZZC7yQB1xKQF928IgzEQS4qIf2sJYKtG+SnpvoyPEivf 6fPzfpogZeITB+2PquS/l+7miJD+ECeqlhPjaI1A2SXT0r0eo0skTKod0arD4UcuZTc4 nXyYftz5OEdreMPprRp8vdDFEN4XIXhHXJwsnY+V24ymIyF+6gP3Hh8o+dQ/8/giwRtx uU++i0p0ScGjOpyNudvHhXi6LkDRv9RLIxRvzUWn1KIXZoZb+qlFw6Ze0YRObdsFf8l6 E/rw== 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=Ydf4fpAiniCjGxWp7KYKw3qDzE8WgROlxAs8zmXBc5E=; b=Pmf8tgEDkbIIDJeMUBTTf6yTjYuCaY/ye6R5GMpOLco/EXY6qX3NLfhycXfG5EqEYi XtQGLU7OwnqpFbLpacl0288+ZyEXlubK0LNQk5TJZ9cYHDspRNarcJ9fcOfrM0iAtE2H TO8AYRc8AdQKbBypXrAD/6k78sqeIJNTdDKm0iBZB6lFu9XWF5Rl97+x5wip14v2XWR+ lBx/rijvRdVEp+i+IKnieuti15CB16xPav5syzeGLO/y5UfZwxtPZCkYi/KjhUbCrNZv wJWcUx56YNicem1+cZ0CSKn9Vju6uILUTwv+sZyHvHFiTJX1DMHbQgOdqX6Qa9I4tbZu 96/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wF4v/9Zz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q30-20020a638c5e000000b003faaa30cadesi26424981pgn.125.2022.06.07.21.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wF4v/9Zz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 DCD90228F46; Tue, 7 Jun 2022 21:09:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346410AbiFGRZA (ORCPT + 99 others); Tue, 7 Jun 2022 13:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345877AbiFGRVD (ORCPT ); Tue, 7 Jun 2022 13:21:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DEAE1059D7; Tue, 7 Jun 2022 10:20:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6B39D609FA; Tue, 7 Jun 2022 17:20:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74848C385A5; Tue, 7 Jun 2022 17:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622447; bh=q6aShHAJlQVWsk/gq5NTtcTJbslhzhx3oIcuqoqOWFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wF4v/9ZzA6kXXao7GI2a+anXWnQMO11CdotvNlL52ixU5jRW8hACxtGcbW1DnYcIj mCodj8LHkNeedKhnuSV+lMrpHBoen5HKJ8dkPOV+4cW3QAALRuUJRLetx9OiZgLGIW 6yfnj2+kgDtgQO25qjXxiYGfls3M6UFPrmmgp6/4= 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.10 061/452] net/mlx5: fs, delete the FTE when there are no rules attached to it Date: Tue, 7 Jun 2022 18:58:38 +0200 Message-Id: <20220607164910.365768511@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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 55772f0cbbf8..15472fb15d7d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -2024,16 +2024,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