From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD202C43381 for ; Mon, 18 Feb 2019 12:00:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EE132175B for ; Mon, 18 Feb 2019 12:00:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="EzI408bn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730189AbfBRMAo (ORCPT ); Mon, 18 Feb 2019 07:00:44 -0500 Received: from mail-eopbgr150047.outbound.protection.outlook.com ([40.107.15.47]:43747 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728394AbfBRMAo (ORCPT ); Mon, 18 Feb 2019 07:00:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Uq1n4f5iH54XlCSr92f/ZnBEQu/1XgoEBBUsmc9rjDQ=; b=EzI408bn1/MPiWiwz117kbUd+77VhfP548HcBksWTkmpKCPces1RKRNxuyNx121Btuupy7Mdk1QmXb3a9QBMbug9gVZVlksiSpxDRSODZyVo53mvqP/JwgLwgmJhDTGX0WzorqfVHWWY9tIFnCOIHl9r320GzTSGan8SEOgs8ZA= Received: from HE1PR0502MB3641.eurprd05.prod.outlook.com (10.167.127.11) by HE1PR0502MB3003.eurprd05.prod.outlook.com (10.175.35.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Mon, 18 Feb 2019 12:00:40 +0000 Received: from HE1PR0502MB3641.eurprd05.prod.outlook.com ([fe80::4041:bb68:2af3:eab8]) by HE1PR0502MB3641.eurprd05.prod.outlook.com ([fe80::4041:bb68:2af3:eab8%5]) with mapi id 15.20.1622.018; Mon, 18 Feb 2019 12:00:40 +0000 From: Vlad Buslov To: Cong Wang CC: Ido Schimmel , Linux Kernel Network Developers , Jamal Hadi Salim , Jiri Pirko , David Miller Subject: Re: [PATCH] net: sched: matchall: verify that filter is not NULL in mall_walk() Thread-Topic: [PATCH] net: sched: matchall: verify that filter is not NULL in mall_walk() Thread-Index: AQHUxSedplubQ8w7dEW1ZWO49IBqX6XhkYmAgAPmpwA= Date: Mon, 18 Feb 2019 12:00:40 +0000 Message-ID: References: <20190215113041.GA10511@splinter> <20190215121120.4971-1-vladbu@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0455.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::35) To HE1PR0502MB3641.eurprd05.prod.outlook.com (2603:10a6:7:85::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vladbu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9143b44e-7084-4cac-d3d3-08d69598b376 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:HE1PR0502MB3003; x-ms-traffictypediagnostic: HE1PR0502MB3003: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1;HE1PR0502MB3003;23:9VGnG7u9XEbPXFDA6aLlIqSWP6rS+dAP+1oX+?= =?iso-8859-1?Q?EUHqBkXpzLdrBH8avDmIqvgtuJ48F78+OTP6r9zQbGm6mxVml/1EtzKjdA?= =?iso-8859-1?Q?GdsfuS3riGSiZB2hK0N4fQDcRjDhJRtFWYsIDu0zXkuWopKlB0A9IYTj+J?= =?iso-8859-1?Q?itd7bJofVhR6XhcmkIlCaKgD9vtmjEC8O7HvqqWWus6QZN7dRG2Em4DwXK?= =?iso-8859-1?Q?wJ45GPW+c1pJh8FgS1YXRTvm6nBXNsuESc/BUEv9Had5dGO3IOCPCLkKw1?= =?iso-8859-1?Q?aeoVvJ5xqzdfY4JW2I/m7CbOdNPbo7zikS7dnBxtjT+zYPL8L3a/+vKocH?= =?iso-8859-1?Q?v4cucimeYuJ0Rhh/z1ZlEQEMHdtEOE0NKqNmc/ZugYnB3tgPBLVrvd+0Ye?= =?iso-8859-1?Q?uN1lqIA5jBG1UceYfbX3hx210iIjn52zoCzPhfhhyJZAtDhMZ7+jNu415W?= =?iso-8859-1?Q?+LVYYJ1/6/ro3HdEvT+CZDa/mOuJnL1eK/xQbfvUDNK6D2VHEr2qa8K7jZ?= =?iso-8859-1?Q?gdyj1FamYw8HcERKNd/ILEx/4rPyuaNSvscJQAHACAPkwTOCa+ZpR8JA3o?= =?iso-8859-1?Q?aoiPOwy8WfYad5D9AHfC+DKaoAeoYBxvgjpnm4/gd5CeeySIfeXihXen4J?= =?iso-8859-1?Q?H1MUFiDS/JD997M7Jd6xdzQUlAeqOrRuJHMggZJgLt22hO+hCD0Lc/qdIL?= =?iso-8859-1?Q?hHBvnW4rA3jxweCaPzaq24nzZ+qW021BQtiCZaIqUogav4+0lW2sFdNOqA?= =?iso-8859-1?Q?Crmv5j9/UC/eqkIc1gZKxHAqED6jjxZTD397woCeKWRIOWpZe6XuaQ+vPc?= =?iso-8859-1?Q?g351vVHewnyLDzWNqBSA6MESBramnhami8o/d3gHbdzEjd7t/MFdnlYSWQ?= =?iso-8859-1?Q?3Q1Ypf5EimyLfebPce89PKZbzeq3oWmC3/ZrBt21aD197XYIHG+5tzmdm6?= =?iso-8859-1?Q?Ynnw2RehbQ+Ya4WKoX0bXdMxeYH6fmvvx5JHBwZhKqi6BNM0tzNEVFFbs/?= =?iso-8859-1?Q?txCLBMpeHYLCa191RNZ4PZPa6wbX90VcRO9mblYyjJmUFZZEgNH9AflBx/?= =?iso-8859-1?Q?aZnFnACWDbNhJNU6c0RPerSzfUyXpusP7LrZZz2ORacH79OGnqlRzDoIN2?= =?iso-8859-1?Q?1KPkcr23QV8nSHk0EwtTf9aZDfwyodRKeJd/5P7AvRhpgMvtwvEfCLvGh7?= =?iso-8859-1?Q?+bczkuYEkqv+uH6wy7vzVAQb7KFIiIKLedrjNfadJI6DvafCScF5z2KAS3?= =?iso-8859-1?Q?4X1s5yjaao552ZvSGoaSOvNyCP3Tan3nzZIXSwspBW/VsepbCRs4mJj2EA?= =?iso-8859-1?Q?RzNA=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09525C61DB x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(39860400002)(396003)(376002)(366004)(136003)(189003)(199004)(6116002)(316002)(478600001)(36756003)(53936002)(66066001)(71200400001)(86362001)(2906002)(14444005)(229853002)(81156014)(8676002)(81166006)(54906003)(71190400001)(305945005)(3846002)(256004)(6486002)(97736004)(102836004)(7736002)(106356001)(105586002)(68736007)(53546011)(6506007)(386003)(6512007)(52116002)(2616005)(476003)(486006)(76176011)(11346002)(446003)(25786009)(4326008)(5660300002)(8936002)(186003)(26005)(14454004)(6246003)(6436002)(6916009)(99286004);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0502MB3003;H:HE1PR0502MB3641.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: SefJ+sRrUVOmml7LGkmmGsEeBqulYW5WrSqQyv2jD+QhtLD9PaYjK3ImMRtDFU8bOrofxuA8hkdeHXyNpY+p2SXboGD0PplSCm9S6VBWykilwIHriLV8eTbzpKPow50fttuUcLSvZWQRcH2glSZBNiXbg8IzXD7bE3tycafbfgTfE8MQ2zIamjK9ff7EB1/zlZiuFIgJh8c6d9LI0sxC0P9jkKerL/NhBvKQjuDPj3CgBZ7+kfTVqUa9jxCi7Lh4GKcXnkC7toaGfkPcqIP5fFr854Vj/5Fke4oVcY0Pg6FmR2GB8hYbgffXJAxIkzfbzZrXw+BaT3cPq4WBTZDJnUbtIYG2eJ/JhDB6/NC/3CFyHuvK8Y+nXwhv/W0KMl8mOkchTih39RanyRLp7qV98IkLp8VqGbO6L03nyReRd3Y= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9143b44e-7084-4cac-d3d3-08d69598b376 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2019 12:00:38.9013 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3003 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat 16 Feb 2019 at 00:24, Cong Wang wrote: > On Fri, Feb 15, 2019 at 4:11 AM Vlad Buslov wrote: >> >> Check that filter is not NULL before passing it to tcf_walker->fn() >> callback. This can happen when mall_change() failed to offload filter to >> hardware. >> >> Signed-off-by: Vlad Buslov >> --- >> net/sched/cls_matchall.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c >> index a37137430e61..1f9d481b0fbb 100644 >> --- a/net/sched/cls_matchall.c >> +++ b/net/sched/cls_matchall.c >> @@ -247,6 +247,9 @@ static void mall_walk(struct tcf_proto *tp, struct t= cf_walker *arg, >> >> if (arg->count < arg->skip) >> goto skip; >> + >> + if (!head) >> + return; > > So head=3D=3DNULL still counts one given that you check NULL after > checking arg->count. Is this expected? My intention was to fix the problem (arg->fn() call with NULL filter) without changing any other functionality, and always incrementing arg->count once seemed to be the intended behavior. However, since mall_delete() just returns -EOPNOTSUPP, it might be the case that author of matchall expected to always have single filter configured when cls API calls mall_walk(). What would you suggest?