From patchwork Thu Nov 17 21:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13047336 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 6E34FC4332F for ; Thu, 17 Nov 2022 21:32:55 +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=eGwby2mt8gwqjL a2bZkX1jaBnGMYG44l9NFC0Hdr7PFouZbup0GtrH1U0Lj124ZPupT6rGaYQkaNVCFMI5ZXw2tnGMe 34tg+URqpdKWV8x9QbdtkF1V2HJ60+mVCdXwORjrKfFTdRKlf7mmLZWiLaoG3QCD2rVVB3qhzvPZQ REVpkgV6tYtWHJUkQ2e6DsC+EOkjrbgT8obURBh7ZnBGkjAyZYTkHaQJjFlIZC4jtPThCM801v1ej A9bR6TkAfqAYVXYXvCxqz9Zy/n4KA12fRLN0x37/CgIuq8A5uSEI7Q2aeji9p7IBwRpfBmZfyCcco IQceqMqRfrRGmt0cyC/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmU4-00027X-2c; Thu, 17 Nov 2022 21:31:44 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmTs-00023q-9V for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 21:31:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668720693; x=1700256693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yQiMXryQ5CnJworTdlI0xW4U42SpOH1ZlqiWstKe+mg=; b=yp/OEvG+3T0ydaAL/Wm43UsLKsTDifecf7MZ1EHsm8UD2tdzLtk1KwfP txyENOd6R31zbnEWDnxJivbxG0wmLQ7Kul9+rw/MsnfJZ4aAzqg94gCur R1pAMRLdNOc5FDfVIVIfI4sAfb7mkMMHGMpeyGJ6Iec3mnmys9TqZuPd+ kc/T+ZyBmq26x56Pbgu800LNV8PmO/nAPchiNbyJtEvv2q1usoMY7LqUP AAnEXItFRk9Ij1fImzYoMFcjs+dFvFbzrFotpe4rmtcg9qT5k1GjkY5hD C59x2KwzFruIYs8vFbrgPeCwMZz67Del4zjPpiSvEs7AHASGhF2AWFlSF A==; X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="184068258" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Nov 2022 14:31:28 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 17 Nov 2022 14:31:25 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 17 Nov 2022 14:31:22 -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 v2 1/8] net: microchip: sparx5: Ensure L3 protocol has a default value Date: Thu, 17 Nov 2022 22:31:07 +0100 Message-ID: <20221117213114.699375-2-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117213114.699375-1-steen.hegelund@microchip.com> References: <20221117213114.699375-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-20221117_133132_406160_A3352105 X-CRM114-Status: UNSURE ( 9.92 ) X-CRM114-Notice: Please train this message. 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)