From patchwork Wed Nov 16 08:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 20814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp32916wru; Wed, 16 Nov 2022 01:01:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf46PEozeiak5b0NWh+yAfdz5P1RGon5RoHsW1kiOcCw2uEMZVnnWxgdNFbjpOYNyiY/9N1w X-Received: by 2002:a05:6a00:bc6:b0:56c:f87e:c662 with SMTP id x6-20020a056a000bc600b0056cf87ec662mr22418133pfu.65.1668589263639; Wed, 16 Nov 2022 01:01:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668589263; cv=none; d=google.com; s=arc-20160816; b=sWquER7d1LyNYnLInI/NtNOAfpsbvQxDNuCQkU0Vp7E/kXq3kjz86Rmh6mrvLDifVN yOPqb9HGXJepdeDzm/GnzkQkZfcGxHtEWqrXPj22JpA4o2grHW45LPJYZGKAwBs6+1ar msBvNKZBPIfEGOtYFwZtRoCPDCLijq24AS+njz2J0Iyfom9g1xUy59z8U8doOYEjUWJw 9UsE+w8Cb9nTC6LGUJSuZL1kGGyModg6uPQQ04rfOkn1KkHHGl472gwiQhJ3vhI74CCC xq1XGw+ULbRgFRMRVGzMAt2g+zLWJcr0P81mi9pxxmHe2nXA7bWaeDZwb6HJUSkSKnnF w1qQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zl0jZ+xN8oBPlizwzJILYwa2cppYjgMBF6GH8rpWbvc=; b=CAHlEL0u31LGXV7KvSkqtcc63+qHJAFVQdrKqgLKCqP7Pn3GEhPsdul4BPttvRHv07 pOLf4zJ6fWmYKsjhJVsZs1Y2Jcczm5F/0776vw5bXUnLX1oAEuKembYqb7K/4Gjkql3R kd7t/sPAqGcXDx7HWow1e6pfpsdcGh7nB4VQz7gaerSD7zhlsGG1X24fHELwnshsDG2a eSS22Xm3LxdhA91RRzuMlnLz+KVWQrY0XVObgznFcl24k6ZqFwhGXk1gJVLFYYInYx3d 24oxfUlDFWz5DBMynOS6t/1vfwvIm1soPfU+vRsNfdJShJ6VejoPp5oPCDt7ndODSQmJ uGRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=10SOtl3g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm17-20020a656e91000000b0046edc0aea7csi15250593pgb.515.2022.11.16.01.00.49; Wed, 16 Nov 2022 01:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=10SOtl3g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238461AbiKPI6L (ORCPT + 99 others); Wed, 16 Nov 2022 03:58:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbiKPI6A (ORCPT ); Wed, 16 Nov 2022 03:58:00 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26BFF62E3; Wed, 16 Nov 2022 00:58:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668589079; x=1700125079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yQiMXryQ5CnJworTdlI0xW4U42SpOH1ZlqiWstKe+mg=; b=10SOtl3gijhDNTdd69SVJCgTtrzz/2cVBFZUuSFMH4Y/LSPHr6fLV3jW PsnKi54QR5W0GBlJ4cRd7oWVfRlAwU630Tk1EZO8gCavyc7hzU+oHr0EZ roVJpZaP69CuVYIBaLeimiVkUwoh+R8rB95P9bLa3w6BQbhpAY5fAIwiV MZVrVM+VF4j5tMeQM/1d7Me4F/VnmTdtOqTySss9Sq7VijtNDka0CplVT PuTrqltDjcL9mHPnUbPHX/vDH/j7mS8GiNTp6OZakJKWbfk3MxvuLclXP iBZEC8ua0KhPzz3GOzdEM8icHsTH44sP7gVDGJiNpFq6X2vh50eI/pOU4 Q==; X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="200006026" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Nov 2022 01:57:59 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 16 Nov 2022 01:57:58 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Wed, 16 Nov 2022 01:57:55 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen Subject: [PATCH net-next 1/8] net: microchip: sparx5: Ensure L3 protocol has a default value Date: Wed, 16 Nov 2022 09:57:40 +0100 Message-ID: <20221116085747.3810427-2-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116085747.3810427-1-steen.hegelund@microchip.com> References: <20221116085747.3810427-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749642655847231202?= X-GMAIL-MSGID: =?utf-8?q?1749642655847231202?= This ensures that the l3_proto always have a valid value and that any dissector parsing errors causes the flower rule to be discarded. Signed-off-by: Steen Hegelund --- drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index a48baeacc1d2..04fc2f3b1979 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -648,7 +648,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, return PTR_ERR(vrule); vrule->cookie = fco->cookie; - sparx5_tc_use_dissectors(fco, admin, vrule, &l3_proto); + + l3_proto = ETH_P_ALL; + err = sparx5_tc_use_dissectors(fco, admin, vrule, &l3_proto); + if (err) + goto out; err = sparx5_tc_add_rule_counter(admin, vrule); if (err)