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: 13044558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54AF2C4332F for ; Wed, 16 Nov 2022 08:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+ncPM4gXFg5vot4zwz7rSMkC7p7rPqQoDQhakbJH72c=; b=euzUDjOHRpGgO8 b0HntFUHJliifzBHoJmzSU8V5rhjpJW1ijowpsKh53yClFyhPLTCH2wSgj6IuHDIj9NLtxRgCOXp/ zQ64qlX8NZJhPqaj9jbJJ6Iq+rb3wN9Di+WTneB8KgRgv2Ynh+7SEbtTjN1bBAAYw0abQrDqJG1W7 LRsn3Pyp0jwDN5LkvnOIik86/HUf6V9ePT5Bk3Ipp3j7Qe6wYtLUQD2+TfGZPXB3R0HZCmDSKM8wZ VykkLYZky6c5Ilz06rTGda+r45O4CYGGCrAHWXzdNMxEtQ3u3duGD5pV47b3JByqpZX9Gx9WKLWBd rdSrO93NNeQI3Vd67l/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovEFH-001PeH-TY; Wed, 16 Nov 2022 08:58:12 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovEFA-001PYD-PR for linux-arm-kernel@lists.infradead.org; Wed, 16 Nov 2022 08:58:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668589084; x=1700125084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yQiMXryQ5CnJworTdlI0xW4U42SpOH1ZlqiWstKe+mg=; b=HPZ6Zp4NCJb/9M5zyvpf7FixjF67zbWbE4T+h09Vb/P0mSQhjquq+8JE 1A0XHVFTEjRWL/z5j2oQiptl8NvRxw8AMuvuA+iuqgGlPPXMKPROltFxz FsbMLsvrHA3RwEMQpSv6hf5b8m6MBiN4XkgL67wOBen2jWm4pcYsVXP+O N7EwYsXDQf+DGhvpEgLKlZK8dxSULBnmeHpla5VGLcUus9kBCQvTzohc9 Y0GjEbWBXMmxFTm8FkoVYpVlGoS8NMIEKxAYRzlPoqmEEkssyLpimR5Gt GXhSgKDHUiSiDRNiTGwbSDp9RYu9kBFb8/eskrbuGqKEZeQNGZKtmANli g==; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221116_005804_853726_8A0BF232 X-CRM114-Status: GOOD ( 10.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)