From patchwork Thu Jun 1 01:22:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 13262889 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE544C7EE23 for ; Thu, 1 Jun 2023 01:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbjFABPK (ORCPT ); Wed, 31 May 2023 21:15:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjFABPK (ORCPT ); Wed, 31 May 2023 21:15:10 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A651B125; Wed, 31 May 2023 18:15:08 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QWp3728NCz18LSq; Thu, 1 Jun 2023 09:10:27 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 09:15:05 +0800 From: Zhengchao Shao To: , , , , , CC: , , , , , , Subject: [PATCH net-next,v2] selftests/tc-testing: replace mq with invalid parent ID Date: Thu, 1 Jun 2023 09:22:50 +0800 Message-ID: <20230601012250.52738-1-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The test case shown in [1] triggers the kernel to access the null pointer. Therefore, add related test cases to mq. The test results are as follows: ./tdc.py -e 0531 1..1 ok 1 0531 - Replace mq with invalid parent ID ./tdc.py -c mq 1..8 ok 1 ce7d - Add mq Qdisc to multi-queue device (4 queues) ok 2 2f82 - Add mq Qdisc to multi-queue device (256 queues) ok 3 c525 - Add duplicate mq Qdisc ok 4 128a - Delete nonexistent mq Qdisc ok 5 03a9 - Delete mq Qdisc twice ok 6 be0f - Add mq Qdisc to single-queue device ok 7 1023 - Show mq class ok 8 0531 - Replace mq with invalid parent ID [1] https://lore.kernel.org/all/20230527093747.3583502-1-shaozhengchao@huawei.com/ Signed-off-by: Zhengchao Shao Reviewed-by: Pedro Tammela --- .../tc-testing/tc-tests/qdiscs/mq.json | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json index 44fbfc6caec7..e3d2de5c184f 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json @@ -155,5 +155,28 @@ "teardown": [ "echo \"1\" > /sys/bus/netdevsim/del_device" ] - } + }, + { + "id": "0531", + "name": "Replace mq with invalid parent ID", + "category": [ + "qdisc", + "mq" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "echo \"1 1 16\" > /sys/bus/netdevsim/new_device", + "$TC qdisc add dev $ETH root handle ffff: mq" + ], + "cmdUnderTest": "$TC qdisc replace dev $ETH parent ffff:fff1 handle ffff: mq", + "expExitCode": "2", + "verifyCmd": "$TC qdisc show dev $ETH", + "matchPattern": "qdisc [a-zA-Z0-9_]+ 0: parent ffff", + "matchCount": "16", + "teardown": [ + "echo \"1\" > /sys/bus/netdevsim/del_device" + ] + } ]