Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp517571rwr; Wed, 26 Apr 2023 02:35:35 -0700 (PDT) X-Google-Smtp-Source: AKy350ahy43vrI+DW+QQ5wM3MtCjj7tScJuDXqi7aIkactV1C6j90OWRA/bbX8BYFEFbfRlD/8Xn X-Received: by 2002:a05:6a00:b87:b0:63d:2d99:2e91 with SMTP id g7-20020a056a000b8700b0063d2d992e91mr29126097pfj.28.1682501734780; Wed, 26 Apr 2023 02:35:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682501734; cv=pass; d=google.com; s=arc-20160816; b=Jf8jppSx+diewKYJphGloACnlB1YvTcVG/5nRtATm5vIW2uBwRYeqiLid+Zfbfxv/D fg56ElIMjRxj8az50Y4OFbStmIGLGCm7NgsxAEgni++Bxa9Z14OydPbLUTU7guxukD4V GLega+YZfl3ukmIrPtCY+BsBD881uGvxAOcqTyiajO8H5W0/sDobXuuepHzBBhMQ1m/y GFPePO4WH6V0afNWERIQQ3kl0JoEA1nrwyLCArL9TSEFKef3dIQmmRkCLwHhUb20l6p2 mJKF7nzpR2HxiZlA4AgTdScqlXFFPsZMOQoLs1WVARmeq900ktyiA/r3K3Rk+w7vJ97v dQZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M5cnDIurI5d0zgWiAunpe6t8qwIAMc/W1o1lHbSqxgk=; b=kYMEma/YBy+ZONglySQvNEuAuBJ6uVaG7jmeROqg6LYm36fgDjd/tmMJ4HlAHcIh7G vmfmEn5RYS4RrpOjCPemvrqMJXkICbL7LShSohAA7CIYUCx38xeViF/PB/LCqN57O+T9 akHw3W/vMQZqcIymMnBNo71p0njifXftncYQ0wsLLdF0o4eqPY6ZJPSOvw9FFlXvXqn+ fmbBjiNIvnGqFGzYJbrSqz9ICfgBKLSxo3oECc7JCt/YuvTSHAKqQZ72LHN0xqVj8mdL jcHzl4VYIy7lubo1+eMeQeejHPb0vZKDsv6z51c32P2qG+1MrRooJx+LyRnj+/ZNee/t ygOw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=wNcrtSV1; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a63ce09000000b005192614041esi16040610pgf.519.2023.04.26.02.35.23; Wed, 26 Apr 2023 02:35:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=wNcrtSV1; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239702AbjDZJ3l (ORCPT + 99 others); Wed, 26 Apr 2023 05:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240347AbjDZJ3U (ORCPT ); Wed, 26 Apr 2023 05:29:20 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2100.outbound.protection.outlook.com [40.107.237.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD0835BB; Wed, 26 Apr 2023 02:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AJGwCynTGNfmb/87JGWoBO6niOvmrahYPJd36ytre3Fywyo78pj6csyRZp0pReWCcudcdSJOrR9GBdkkbRGywafZ6MWuZV5DKc/322mNh4SV46LOqwskZs1PHkPznLNu3j67M0oF41qo8bavIRj47bWWkMpZyAK//XrtJtu5tSvcAVHOHOAMf6VqMlUakmwAKX03UlZah1Gs/qaMwgdwpZg7WyBUcAmyY3rIk7hWgLYNwX/emElY+IUYqS4+I2chDZ0eUWdNCzyLygOgdlE2vYpAmfsRjSCNkf6DJSpx23mHhR33kcNkkuVT4FDnUsMFgza1RsLe5IfO6DHkcgcyrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M5cnDIurI5d0zgWiAunpe6t8qwIAMc/W1o1lHbSqxgk=; b=ZMe2JWphSKcrOmimK8GCPdQFtev9OLjKlXokelD4g4J1EwkuKYoW1zinBJfemEDSIvDjRaPI83i3soJ+12gryBmBIQWbn8eXlv+D6PLMImvgpeDiurvGyh+KXKSyPgSvqMH0B0F92X7AXneahb4SkZIKKjV/w942hhTYY2vpfzGFxYuaqhL511HP5iqAljNLxduPciPhadlW1pxqSNEAfRM9RaBQzLUAqbrKD+HLm+p2NDqT+A1WXPNwwmO3+vFFOlFLZQGF3VeRTpra1u9XiOqsvwFLvP4C+LXCL0pbdl2d6wTeT0U/0pczhRSQM/ys3fXaaWaN597C2DzGmWVCvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M5cnDIurI5d0zgWiAunpe6t8qwIAMc/W1o1lHbSqxgk=; b=wNcrtSV1RidpBQhR3MEU/0wGkuf1XMKcddFLdwifK1zRlduECxABQJdhnlTYvxZT7U+UAchSj/tPk2esmgwxGSEyPK8aULVKuq+rWx5j8GivoA81jffxqhaWdkGhfCYM0Y3xpiXlkE2IPyShF+HNgSJLkdkjWUMyDPPfYPBGBnA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by SJ0PR13MB5383.namprd13.prod.outlook.com (2603:10b6:a03:3d7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Wed, 26 Apr 2023 09:29:10 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::f416:544d:18b7:bb34]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::f416:544d:18b7:bb34%5]) with mapi id 15.20.6319.033; Wed, 26 Apr 2023 09:29:10 +0000 Date: Wed, 26 Apr 2023 11:29:02 +0200 From: Simon Horman To: Ivan Vecera Cc: netdev@vger.kernel.org, Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marcelo Ricardo Leitner , Paul Blakey , open list Subject: Re: [PATCH net] net/sched: flower: Fix wrong handle assignment during filter change Message-ID: References: <20230425140604.169881-1-ivecera@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230425140604.169881-1-ivecera@redhat.com> X-ClientProxiedBy: AM0PR07CA0003.eurprd07.prod.outlook.com (2603:10a6:208:ac::16) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|SJ0PR13MB5383:EE_ X-MS-Office365-Filtering-Correlation-Id: bf071263-9777-46f6-6871-08db4638b08b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KYPSQ3XRnJRcm5i9rSt2dEWFPIf668xiuwsek2gKa7RHO7O+I9cOEFAQOUHl5xHHZHEdvcK5ZX/xNjKuiJP2NSjNQL8k2MsATMH8epTJ15wVLw2vWz6K9SRy8hDqxTBUSx0tna3+MlpRwQhiWB7tfmPEhykq6FsxfA7TAH8zwtdnOLoGVW57Ir1fiXv/RHHP/JEAiwsd/Zie9oft1k8vYLhV1me/peEmEl56XSrROXfIzmW/2bCraZXzz8UTHXfhjpFpTbiyEKlZ3/DGqrd6qvWettpB8H5UgsHHsGQobtjMJ8QS5k4Im4WfU16rji5GdXpPGa2LDguo+wd+Br2yWSU4RJqgQXa7sMhZ+iis306C1EiSK2jzIxiAq83gLwOEgf/VGrgaLNohJ7jyGhLCzOcDVKMC37tNOn3t/fQszeoilyXWdXhoWn0vht5st+d/0jIutLaIJP3fbaOLUBX4jNUY0pzVdQ+rg0cyYMrEwT5Bq1DIcKt3Pm3ebNa44Sj3wBK34u+TFh6hMH0eEjOQ1mUHp1IG+gEXI8QGiAw4oXOWVD3IhPKdr2/s7cRo9o4o+RdArk3l+YCNlpVMDyPNrts8Egcz8BHYK/gkVoahJMk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(366004)(39840400004)(376002)(346002)(396003)(451199021)(44832011)(6506007)(6512007)(186003)(316002)(66476007)(66556008)(36756003)(66946007)(6666004)(4326008)(6916009)(478600001)(41300700001)(8676002)(8936002)(54906003)(5660300002)(7416002)(6486002)(38100700002)(2906002)(2616005)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+G7K+CifSXd5oNcZUJAq8Yg3Jv25gMarjhinN8G9XbdYtWZ8/UnQyn9MCOnJ?= =?us-ascii?Q?+Ev47fjuvzP2Y/zryjcgKjcno6nobhfuCE4N6rLWTgjlS5Y+LLOyo2Lsi9eP?= =?us-ascii?Q?BKh3oYinPbc2Oi/ikdlGlT86UBt6uhueQq8nWwn4zfFUQD4/vjhsDJQhwUd+?= =?us-ascii?Q?cSe4zgkDDEz7SWm3f98XhyDoh5cxAD6LuZpdThx5g8eFi0VuYsIHMrGfhLDc?= =?us-ascii?Q?CiHbZ/QBn7mu5p/WRX3YaXBAxgBk6eOaucuBZIx+5DsTuOm/4sghIKWf5NAF?= =?us-ascii?Q?A8mKpUm/4mOYu4uA4qGZkJ/NfQzYpbwtoVCbcS0Lqd2a43H00cXdxlcc+XgP?= =?us-ascii?Q?GAc0d/Hhb+6AI7M00wUN8DtPokeO6oFkRhBmVyNWApo4V13+q8FgZXwWd7tS?= =?us-ascii?Q?FIj4IuYohCRfcTxCSOHx4ONNh5PBV3kEX1lQqPCVMTqKkvNPRn56szwPvKVP?= =?us-ascii?Q?AyduK94F1BBDrBBjJN2ru0Kc0Y6+397sgIdsSQwVz2rjK540TzRjemOi36F8?= =?us-ascii?Q?zEQGxA5VBzTwAZTAKMZRy1zRWeABUTSTjTPsR0MxAUaitGGc3BixzSNq7hP9?= =?us-ascii?Q?/oN/sUCwRsUFNJLyOBd60+aIhnRFWPFn0lGLCSIOHPZLNwMGX61jUddSUiPu?= =?us-ascii?Q?dOedbVIr2ZH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SYD?= =?us-ascii?Q?dlSoHApr19r6WygUKgsEa9SS2KtMXr6mkCMcacWt9leHzvaxqNv4/VjgzXc2?= =?us-ascii?Q?wvOhLqFVBoS45Qc7bvWgMSJTKpSgayL+BRGUTguDGK5sH5Wp89b66bW1ZLtN?= =?us-ascii?Q?9qXGRQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf071263-9777-46f6-6871-08db4638b08b X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2023 09:29:09.8887 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2MBGwehneqE7JRkSnGAAd03btH3hBMAiExoz6IlbUgygb3E6ayZTdX+YRqL0SiUieSxCoGh6MKzZPrggtWiMcybX7PLaX8PncPD6+9+JzXI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5383 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 25, 2023 at 04:06:04PM +0200, Ivan Vecera wrote: > Commit 08a0063df3ae ("net/sched: flower: Move filter handle initialization > earlier") moved filter handle initialization but an assignment of > the handle to fnew->handle is done regardless of fold value. This is wrong > because if fold != NULL (so fold->handle == handle) no new handle is > allocated and passed handle is assigned to fnew->handle. Then if any > subsequent action in fl_change() fails then the handle value is > removed from IDR that is incorrect as we will have still valid old filter > instance with handle that is not present in IDR. > Fix this issue by moving the assignment so it is done only when passed > fold == NULL. > > Prior the patch: > [root@machine tc-testing]# ./tdc.py -d enp1s0f0np0 -e 14be > Test 14be: Concurrently replace same range of 100k flower filters from 10 tc instances > exit: 123 > exit: 0 > RTNETLINK answers: Invalid argument > We have an error talking to the kernel > Command failed tmp/replace_6:1885 > > > All test results: > > 1..1 > not ok 1 14be - Concurrently replace same range of 100k flower filters from 10 tc instances > Command exited with 123, expected 0 > RTNETLINK answers: Invalid argument > We have an error talking to the kernel > Command failed tmp/replace_6:1885 > > After the patch: > [root@machine tc-testing]# ./tdc.py -d enp1s0f0np0 -e 14be > Test 14be: Concurrently replace same range of 100k flower filters from 10 tc instances > > All test results: > > 1..1 > ok 1 14be - Concurrently replace same range of 100k flower filters from 10 tc instances > > Fixes: 08a0063df3ae ("net/sched: flower: Move filter handle initialization earlier") > Signed-off-by: Ivan Vecera Reviewed-by: Simon Horman