From patchwork Wed Apr 17 14:43:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13633499 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39E1C1422DD; Wed, 17 Apr 2024 14:44:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713365081; cv=none; b=HpwTiTGs17N0QJbLUF+CIiYUBhbHINucuifLaP7FkUlQuTZ/D3NCMNKKjNPChCDsrvX1GWanIqZvSMNZZ+djJ0F86e6xxVLwFQ7/5MBJ13diKLaPHdPeD+QIGwD3aVVKSHNzIkVaSbdYXp0iGQ4OXxwApvf4Cs7QN/HFaq+9UPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713365081; c=relaxed/simple; bh=rrJ7n75EIyuAFCln7lBnBkC5hjWcPtbZH17TwmJZfvE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gJ7Vhse8bqnQRJ6hvSfzmcHsSWDic80JkZC19boShMLv/O7tsDZWsczpDwm5vT9nKIuKP7VncnvpKg3r5hJ2HlrYj12hVW9Tfp/2L8uXj9JUnNWoqvsm2+0PJQNPWvOL9d+XCAkSMfpWHauGj5OCPc00Lb9fP9r0Fd8SG9VyzIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=T2Aa33Gw; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="T2Aa33Gw" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 39A52600A7; Wed, 17 Apr 2024 14:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713365075; bh=rrJ7n75EIyuAFCln7lBnBkC5hjWcPtbZH17TwmJZfvE=; h=From:To:Cc:Subject:Date:From; b=T2Aa33Gw170VjuixaQ5ondCPu5fmMT4KbChRGTbnOrl9HGBSlwN8bMipdWEnzeGF9 /6uDM5L6xmBiguy0tpZwAxBT5L35uZDTUNAsmIpyFM0VFhfiuAUwc8j+qqfv2afAhk zB13JBSq0zyXzI8pCtZsvAuTyoNLfbisT7H29H5XuwUV820FtsYVVcaVOCQhsLt1CC 25EfJu3KTF3B5jhPmxSeCUmGuqGGbbThTdKxncSjSoSCb54sCTQ65ERN7eDFNchtRb /FZLdstYO8ppkdLhCBVC1LzQwxKhR7A1J6/JOjWiwQA9KgkGr5i9ZRPWevtqzTpLrA v+bpDFPCzv0ww== Received: by x201s (Postfix, from userid 1000) id BA137203AC4; Wed, 17 Apr 2024 14:44:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com Subject: [PATCH net-next] net: mscc: ocelot: flower: validate control flags Date: Wed, 17 Apr 2024 14:43:58 +0000 Message-ID: <20240417144359.104225-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org This driver currently doesn't support any control flags. Use flow_rule_match_has_control_flags() to check for control flags, such as can be set through `tc flower ... ip_flags frag`. In case any control flags are masked, flow_rule_match_has_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/mscc/ocelot_flower.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c index 33b438c6aec5..a057ec3dab97 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -609,11 +609,8 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress, return ret; } - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) { - struct flow_match_control match; - - flow_rule_match_control(rule, &match); - } + if (flow_rule_match_has_control_flags(rule, extack)) + return -EOPNOTSUPP; if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) { struct flow_match_vlan match;