Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3784457rdb; Wed, 27 Dec 2023 22:44:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKBg6mLzwwb56ZlCRuckk5igYPuiyntqOAlfStdZg75NyWtOnn04EN4hfXX3f8wkzkOFrS X-Received: by 2002:a17:906:f9c5:b0:a27:6ea:4add with SMTP id lj5-20020a170906f9c500b00a2706ea4addmr1073176ejb.85.1703745879752; Wed, 27 Dec 2023 22:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703745879; cv=none; d=google.com; s=arc-20160816; b=hiyG8XkXYL+ewTOr9lBK67K/TwiuS59NCpPaOtDCVDR/7cuy2GkqLiVALswOEzX9/D 3eWC8FDEVkCbAqAImF9LADrWCQmj/e0rQHaqakvmEtY8HnweMQMPg9BHdh2c7duUNTeN nNzb2BbzDD57HtkTckd9C6MvTiJtj13a9CYnV38KLR8WPk17OPTqikhmqpe/942aUU0B QQvnjlRCbnK9vjuA5BX7QJenh1H79hIlf6HB7eaD/2s/kz+//A8nXO4P7ZPO4RlhmO4G 4o+2RkY4Iq2hP0BrJTa3XgtqmL3Ckoucqdpt07yrlXBlFQ+ZmhaAqiR/zDHWDsrlbbdB NcvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=NMzIrQHaQTgDtnrvcXV9vDgOv3mWiwYr/I3HYbVm160=; fh=KYovjcnz99Uc/wxgCfEKehITcqlb+4FKQ/03gJzLrs4=; b=gP/ZseSaQSInU9ETbPK6uTcBuibL3ayIZoqIXy9sijV+/XiEEdPuzDCgWMv0/ZmZqU ED4bjYoyn487dWFGWSiHGiP6WtX7t4xMxpdePtkJs/uQG+LqEOqLpvKvw5JTsKZ4m3eT 4Lu0iAvOi+g3a28Z0FQZb3KCbf0rl5Q1ss23cFnuzWPCpAjrNujEaJxnJW2eiRSa76Ur R11yPZHQq7VaqzbGRbhNVuLmW/t2c94+ieO65qSFG4XDDtXwxwmxqpJ1KS38hYmJga1i hxvvOdaxdQNm2K6n3fnNIlt+7h2x4flqOR3DlxNGfjAbC6BD9yS6mp0YsCGOUmTe0aGk XAQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12466-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12466-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o8-20020a170906288800b00a2341b26dc8si7096291ejd.569.2023.12.27.22.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 22:44:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12466-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; spf=pass (google.com: domain of linux-kernel+bounces-12466-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12466-linux.lists.archive=gmail.com@vger.kernel.org" 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 816A41F22653 for ; Thu, 28 Dec 2023 06:44:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02DEF4401; Thu, 28 Dec 2023 06:44:30 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net [207.46.229.174]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF7962909; Thu, 28 Dec 2023 06:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zju.edu.cn Received: from localhost.localdomain (unknown [125.119.253.75]) by mail-app3 (Coremail) with SMTP id cC_KCgAXjo0vGY1ljQGVAQ--.6801S4; Thu, 28 Dec 2023 14:44:00 +0800 (CST) From: Lin Ma To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lin Ma Subject: [PATCH net-next v2] net/sched: cls_api: complement tcf_tfilter_dump_policy Date: Thu, 28 Dec 2023 14:43:58 +0800 Message-Id: <20231228064358.3042747-1-linma@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID:cC_KCgAXjo0vGY1ljQGVAQ--.6801S4 X-Coremail-Antispam: 1UD129KBjvJXoW7CFW7Aw1fAr43CFyfXw4DCFg_yoW8GrykpF ZrW348Cr1DXry8Jws7G3Z7uF1agrZxZw47GrWvk34xZ3sxJrn3GFWftFWak3W2kF48Arsr tF15t3yUua1q9F7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkE14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4U JVW0owA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUdHU DUUUUU= X-CM-SenderInfo: qtrwiiyqvtljo62m3hxhgxhubq/ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: In function `tc_dump_tfilter`, the attributes array is parsed via tcf_tfilter_dump_policy which only describes TCA_DUMP_FLAGS. However, the NLA TCA_CHAIN is also accessed with `nla_get_u32`. The access to TCA_CHAIN is introduced in commit 5bc1701881e3 ("net: sched: introduce multichain support for filters") and no nla_policy is provided for parsing at that point. Later on, tcf_tfilter_dump_policy is introduced in commit f8ab1807a9c9 ("net: sched: introduce terse dump flag") while still ignoring the fact that TCA_CHAIN needs a check. This patch does that by complementing the policy to allow the access discussed here can be safe as other cases just choose rtm_tca_policy as the parsing policy. Signed-off-by: Lin Ma --- V1 -> V2: send to net-next as told by Jamal net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 1976bd163986..2b5b8eca2ee3 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -2732,6 +2732,7 @@ static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent, } static const struct nla_policy tcf_tfilter_dump_policy[TCA_MAX + 1] = { + [TCA_CHAIN] = { .type = NLA_U32 }, [TCA_DUMP_FLAGS] = NLA_POLICY_BITFIELD32(TCA_DUMP_FLAGS_TERSE), }; -- 2.17.1