Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2353484lqt; Mon, 22 Apr 2024 08:28:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxSz+drABv4VqB6l73pw1LfSa8Dc7Q1nao3apUaNJdA30TYP+BYTJw0hP2PQRb1pVwKUhjpG+o0G/+gh55dqcYt3SZ/OxV/5t4z7YH0A== X-Google-Smtp-Source: AGHT+IH0ri/hW7NTFBYNMyDdctVh6sAlwA99HBwIkByY6QsWl2uHy/QKLbeqfqZlPibv4dRsUr/5 X-Received: by 2002:a05:6402:8ce:b0:570:5b71:485b with SMTP id d14-20020a05640208ce00b005705b71485bmr3683edz.6.1713799705734; Mon, 22 Apr 2024 08:28:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713799705; cv=pass; d=google.com; s=arc-20160816; b=Y8hCoYPcdCz6rsOcciMIcNxydtrV9s/L9cl8zmXf3/Bi80GTb+hxxmSLGOW06klfJs CusAqQ6e4rUrVJ5bOxvrei9Vl5I/IM7bUpj/oJW61/sJ2NlxhVLdAhCFoDP1D8aivCya 9LI18Y3NznFXzH1K5bXxxwrKlTviGE6o6X0KZikp5O8WPQZ9IVoI+bMX7ni3OBEKJ2JA SRoNblP8dIayIwdW3WDBFc70noQY3zVzz/uIO6zmV/tVH8VbmbbF7UoJcchXAoGc6AEa +S9FhgTjwTbykrycLKMd+0HOeFbjKJJHr251FFNdQYHAainHM3SXxVlJFoJ4jjZ95dK+ Gv8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=1auvCHqd01nfzTb1qIcJRuxeVhXFu0TneB5GVxIOwlY=; fh=BmwDlgKcNdw3qY/+oxqUqVUvIIj7EITGSNmsjJ49UEY=; b=MrOqYBPf5RtZKrx3DgQjblbv0DXgbRVeDSeG97eO5WuY0xaBkRYfh0quFNqOIC3ius Mfivx+fXeB8ps1md/M+hUqnKxsXkq5VeOZ+jY5U+XQrE2W1vt/+tHDhcr+OcB2KUlsep r6RhlKRWLAMgLMa7jX/OGiRXrh/jJ7cGXv0+S18wkhMqDyfR0NBqIK0oNx1gHGufKENe MGsAMSVheFTx+2Os0NQYjgAIplWNBUkRJQ0eqc1yIgUFAq8gd/q3ySsgrqBNRZ+nksnv b3sMLRaoWQXhjmilBcN2UWsEXvWBtHj2o+yqd1XYLMWhscLhOt2CbuLNWL4mNr9Ii2dh zGeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b="i4+/65a3"; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-153630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a3-20020a05640233c300b0056e5c132f49si5963212edc.592.2024.04.22.08.28.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 08:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b="i4+/65a3"; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-153630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 759AC1F23009 for ; Mon, 22 Apr 2024 15:28:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D59515356D; Mon, 22 Apr 2024 15:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="i4+/65a3" 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 DCC94152DEE; Mon, 22 Apr 2024 15:27:56 +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=1713799678; cv=none; b=LppVupMc54RZ/eGdHovfTkikgHvy4cbFhJjlRSR3C34vGC4O7kuMk0zu1NPni/1khHCZ8aaQFuzTXXo8lbXOOaIrplP8XatG4KCCqDnrz3ZSKq52284Jqk5phfSkdxhgu/NQZ43NgVNDIWeqwi3FbD2KMjK0zbZ9Ck6MrIGI9fc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713799678; c=relaxed/simple; bh=PgMgV906dQV29XTm6swQ99RMW8rFFJ1Z5BLFx0F/mWU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sNERPjf3SYyvbzOfXInBAloiZIcqK2D3dDAMO3ZsJw2WyPZ48QTClz2dlAt55Ye9S6HPEqs9bBgCQnLOaZavHtEpM90RbQutobJE8drUbHUw1AKeK4xTWdSCnSeVFlj259ae2Fb25RHXd8rGCfk7E+HVIa0gJ11OVIsGkoRrxow= 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=i4+/65a3; 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 Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 238A0600A7; Mon, 22 Apr 2024 15:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713799675; bh=PgMgV906dQV29XTm6swQ99RMW8rFFJ1Z5BLFx0F/mWU=; h=From:To:Cc:Subject:Date:From; b=i4+/65a3GbXEMxzAQU1QcGwBF98t4iFEYyuBCZtlU0QwmV8vp3KKAhud393jZ9a6p uFeAR9COPXfofloTOzwVxXfXZ7q48Oe18P0SH7d6mdN2aXsSvk0W5w+WIn34hJ6ZGg VNkl2jN5E731fHKQ6KPtomZsJs2++zg1IHEMrmBmIfC3dTL2jbFkXHuuu30j1P2jKd uoZWAVxGb3KRhh4aoIxHavUBdoE4WoJ+A8SCJwHMGxi2yhbbGfnD6XlGqz77moJhB0 PpRRILz3ShR8nPi+YNJmC2c+R3iecdGPiDdsjhCXZY9fWxGyV32hBK0g3k8LYuK8Gp LfbGbBZpgqrLg== Received: by x201s (Postfix, from userid 1000) id 4CEF72050C0; Mon, 22 Apr 2024 15:26:31 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Chan Subject: [PATCH net-next] bnxt_en: flower: validate control flags Date: Mon, 22 Apr 2024 15:26:23 +0000 Message-ID: <20240422152626.175569-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/broadcom/bnxt/bnxt_tc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 273c9ba48f09..d2ca90407cce 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -370,6 +370,7 @@ static int bnxt_tc_parse_flow(struct bnxt *bp, struct bnxt_tc_flow *flow) { struct flow_rule *rule = flow_cls_offload_flow_rule(tc_flow_cmd); + struct netlink_ext_ack *extack = tc_flow_cmd->common.extack; struct flow_dissector *dissector = rule->match.dissector; /* KEY_CONTROL and KEY_BASIC are needed for forming a meaningful key */ @@ -380,6 +381,9 @@ static int bnxt_tc_parse_flow(struct bnxt *bp, return -EOPNOTSUPP; } + if (flow_rule_match_has_control_flags(rule, extack)) + return -EOPNOTSUPP; + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { struct flow_match_basic match; -- 2.43.0