From patchwork Wed Apr 7 15:36:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Buslov X-Patchwork-Id: 418061 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 4C51FC43461 for ; Wed, 7 Apr 2021 15:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C96C6113A for ; Wed, 7 Apr 2021 15:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343976AbhDGPgw (ORCPT ); Wed, 7 Apr 2021 11:36:52 -0400 Received: from mail-bn8nam11on2080.outbound.protection.outlook.com ([40.107.236.80]:57313 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243477AbhDGPgt (ORCPT ); Wed, 7 Apr 2021 11:36:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ojb+ZrPcq3ZVrt+1bNKYZ5VPFxCBbAQQcxd1GfRowaO056UnUCQ0Z73y+mR3SAhh3jkeT5oDrSSrd30B5BbHbLRaIdpf3CN1JQinr8BU+3bvpHLetaN1fwEPVXlmXP8sFYPJUvJUF1aodmi6pufRKL8YHPKGSZU8o9aFawwP/t+5XXIsBHR80brnUMVPQyyuXwtcJoZDEeyI4pnWQAlqrXwOIugAusDuxgox0KOyMI+JjFJd15iDKtojWX5qaFSEmWe61yhlRAfT41Xorj3T/PtMQU6eX8hl/WEXP6KMy2WoNLyWVm424UrGDPrJCwyiMxVx8t/FGhByHoU5seM/zQ== 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-SenderADCheck; bh=SOfIe9gxnRRrWCs9x3ma1TQIoFwY+vgBSDrQeQlaks0=; b=ZGhSizPvswEXfkiLSqfyaWZtkmY41XGW4RmLEyPN8Ulz2UFAcY4IvYgZL8lYLTgMNfdfKcvGPrN1U7r1tD+e6cR+Z0iJpnsNRC7sNyP/zMT10XaocAWVEdxXF2RgaupiH+DE/so/li3/eK6zOnugYql863zSycoKehDi092q5z6ONTp0Ku4H3LN6VEJSrVmV6/VeKTY292OMQffXznoj++mUsJL970PQhxZYuyN5HrkqIMs2gTN8X9Zt1C14uUbOAiY98qb+6N2XZr3zIGH+yEtasyU6p7ufYloPmVAe5ETZJY3TBoPUGfLo00KiylPxqlL8mv8pQrwGYpLTcBzdUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SOfIe9gxnRRrWCs9x3ma1TQIoFwY+vgBSDrQeQlaks0=; b=ofJZ43tW0wwtRosRipDYlDKxr/ImtmT31OyKYorbWIIzFRFaHG0nNeB8N546G9/m42WwSL3chlU8LLco026hbecE0B29QEhFlZfKD28hdjDBUMMIX2t0mUCBf7iOrZmPDQyJJPvOIDo8TzayUl19Ff3PLikoC5UqXmWfER2/b2oIoxEwdN5C9W32mGk4jTaVgc9jkgepeaBeakuO/Z3tkhwBIdIAM+VGfcfoxnS8zdnGn5SX/JN1ZKpyYuFuDgEti9wcJzGbStbU+mWHwwoHt4N+GB13WY49M4SUEbJp1e6Swa+o+Y6a33BcUtMxJg8PY/9ESO8McmxZfcs/biUTUw== Received: from DS7PR03CA0300.namprd03.prod.outlook.com (2603:10b6:5:3ad::35) by DM6PR12MB4763.namprd12.prod.outlook.com (2603:10b6:5:36::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Wed, 7 Apr 2021 15:36:38 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::48) by DS7PR03CA0300.outlook.office365.com (2603:10b6:5:3ad::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:37 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Apr 2021 08:36:37 -0700 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 7 Apr 2021 15:36:34 +0000 From: Vlad Buslov To: CC: , , , , , , , , , Vlad Buslov Subject: [PATCH net v2 1/3] Revert "net: sched: bump refcount for new action in ACT replace mode" Date: Wed, 7 Apr 2021 18:36:02 +0300 Message-ID: <20210407153604.1680079-2-vladbu@nvidia.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210407153604.1680079-1-vladbu@nvidia.com> References: <20210407153604.1680079-1-vladbu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 819fdd9a-d3c3-4bc3-d8f4-08d8f9daef02 X-MS-TrafficTypeDiagnostic: DM6PR12MB4763: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:27; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 48KbCj4zq9NxcM1sW4Lk7q/1FCMgxfeqkK2CHoHGC9/zIHjA8H/ndJ9pAhYgixuaDmiSKQM4Y4/+9gbnyGSBWuICCKY8pnrkzK5nf/FzQp0duYTItKBQq1yi0ZByBlFUjr8WfMquUarZp4McLiMVXumM7CVubWkGWlvkx7FGAL+mubrc5PT+sDuySifS2V5IZoG02PWZEh/KaSyXhzB7MnDjCC5rR5wdfsIcCw4B7SKVpONw8n7dXxb3vrMUrMtROBcEHbJoYVbHbi8J0KodozE+nUtAfXU95Og3NoaAugWhLz1u29+sZtW9oD0nrNlQj1cA1mqQ0WI3xUgzBN+CmZCwa5uspHfS9jFob4mRMxV/JkNmNFf1wtLAQJ/Gm+6PUK5rFamhbXmzm/PPd3J6wwMo2sFbzsutLoGlWPDCwkECQbJ7IewZ4wmp2Xckn8q1zmDoubLDRpswJgEtg/yXhrfcemrCzckiIT5qyWBrcOQswiZVmrosIjC3WgSIs3TTITh/nukgsbXVbRKwvSxABvaoS797bU0gro2UQsNeWiI9o0O4MgEReHQ4uz2aVXbZuivlH9F5XUMvOv/g4KQ85Y2qEN1Cvl2oAPePah/CkkGDVGjDWFWCnEdAYOJMLnPeqkcQW1yn1cb7RVmrYt8wiAxT+wZmaXEsphrRa3zEpPw= X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(136003)(346002)(396003)(39860400002)(36840700001)(46966006)(316002)(2906002)(8676002)(7696005)(8936002)(54906003)(7416002)(6666004)(5660300002)(478600001)(6916009)(86362001)(82740400003)(47076005)(36860700001)(4326008)(70586007)(82310400003)(1076003)(7636003)(4744005)(107886003)(36756003)(2616005)(186003)(336012)(70206006)(426003)(26005)(83380400001)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2021 15:36:37.9943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 819fdd9a-d3c3-4bc3-d8f4-08d8f9daef02 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4763 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This reverts commit 6855e8213e06efcaf7c02a15e12b1ae64b9a7149. Following commit in series fixes the issue without introducing regression in error rollback of tcf_action_destroy(). Signed-off-by: Vlad Buslov --- net/sched/act_api.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 43cceb924976..b919826939e0 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1042,9 +1042,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, if (err != ACT_P_CREATED) module_put(a_o->owner); - if (!bind && ovr && err == ACT_P_CREATED) - refcount_set(&a->tcfa_refcnt, 2); - return a; err_out: From patchwork Wed Apr 7 15:36:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Buslov X-Patchwork-Id: 417226 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 C88FEC433ED for ; Wed, 7 Apr 2021 15:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0D746113A for ; Wed, 7 Apr 2021 15:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347232AbhDGPgz (ORCPT ); Wed, 7 Apr 2021 11:36:55 -0400 Received: from mail-co1nam11on2082.outbound.protection.outlook.com ([40.107.220.82]:24416 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243477AbhDGPgx (ORCPT ); Wed, 7 Apr 2021 11:36:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SgfI3gyCkDGJPwtyrhFs7O0JlU1i3fEti2W3urCsAn/BNpZB0bYszxZo9iQbOxsnxI7hzp0WizYBxg2Tb0VrgAPXXVmQZw1gkEnXWPby1rX9lzjcMUbT3lwfGLurAta7SY4HfB7Gccbwf+fsg9ISnbrZtaxdBg4qvXdeHso6MCGRCHSX+DMXnNf92CUdYjOi1egUNcS4XX2XZYKLnpQntM7Fm3db1QxLWRdWSzw9k/nb6qLMXeFWFTTvcstMI4wbgWHD6JUWJ7/mQPl9MFSp1ak5jc7ep+xtZ6edj1hY4J6g43JzyRF0jgUiPN5PsR7um2HKzTAFHQFQk3hrCOHRPQ== 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-SenderADCheck; bh=uFtD6PelGs6ZOv1/fr0spxAitCUdXzE1snHVILoZxeo=; b=VuTbpLCbidYjWCJsZVW7q1o2H0Nn6Fmx4rZwaqxEooWR4nw3vPWJtWXXFribD8PYE1dZ9BkExaS75MHWFJ1kyXwI5ZBUoGof0i3AUpS7w9+mcXJI287IiIH0mUvu/WWOk45VTkZXkNYfrYbwcyaZWiQCw+Is9aki8Bh9kPH+kBrGUSFCxxbVOpEaV++EkvvjUvq7fnJ3vw4Uve0tqFe7wfBcYLq6SFu1wGM5igCVuUh7/l2Pht7CrrSjUAVeJeE5Zi1hfeo3c76HHGdqHY3bD0Iw4GjgWGFSdqmILhf+3w94w8gLpU2JdGXgHU1muvB56OxLrA9vESz62Y/ACSeCzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uFtD6PelGs6ZOv1/fr0spxAitCUdXzE1snHVILoZxeo=; b=d35tMH8+P3dhJ7QkPcVwAIKBqzx+W/mfpQyGgfSy3LRoSNwVkWbVSQzQ6DgRIJcRc9Fp0h3F/yCdwvFFIZczs4mjSdPUvKVRjwfCTZH/JpPdpyooDhl0uI6UKI8VvJEhkD1i7dKQ1PrJ/oSzr1K4dc29C44exm+lLXrjkkIp9wlTPJVhEM3edATVihrX5U97TjFGiEkL9zAFp0mOLMpzn8SyykdtNTBIt7dRCfYOWLYfyuXpW3QMrI+SfbR4GgeH+Zkfm8AEf/G53ovTOMdi7egPRubteRqBReUpEsMEuOsxz5mrAVPtiL47wI4BhRCatcM5FERSFB036s66MZYZfQ== Received: from DM5PR07CA0043.namprd07.prod.outlook.com (2603:10b6:3:16::29) by BN6PR1201MB0049.namprd12.prod.outlook.com (2603:10b6:405:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Wed, 7 Apr 2021 15:36:41 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:3:16:cafe::d3) by DM5PR07CA0043.outlook.office365.com (2603:10b6:3:16::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:41 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Apr 2021 15:36:40 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Apr 2021 15:36:40 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 7 Apr 2021 15:36:38 +0000 From: Vlad Buslov To: CC: , , , , , , , , , Vlad Buslov Subject: [PATCH net v2 2/3] net: sched: fix action overwrite reference counting Date: Wed, 7 Apr 2021 18:36:03 +0300 Message-ID: <20210407153604.1680079-3-vladbu@nvidia.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210407153604.1680079-1-vladbu@nvidia.com> References: <20210407153604.1680079-1-vladbu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4bfec1a-2249-43d8-6ad7-08d8f9daf0ef X-MS-TrafficTypeDiagnostic: BN6PR1201MB0049: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:469; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qNT/n8zMeqiFDGKCb4r3Fq8e2rdKZ99uhlq6FuM64dFE2X/XXoA8WV1tSG6QpxA6ask5YnBaLw8bsIckQm5eoyBnM3hm0EBeZkG0woK9165lpqQUwg8OtZMe7uUSeXD8uhxLSD5YQploAS9DP1jIbcb4PIglAym8HpRkSjoHkgGFXcFnJU143WuxRgrU6lxRpa1adhQTxaajh/0T8+skfDOYdxhaAMVmejZUmvtpMXJ8CEe7zw/aSvZihUecNA0opRNTRyeS12iRKSh1fudwRY1l1PvhUZKvfWn/G+lXkxgfDeEh6cNV/+HGFy+NVzY4ldRzfhWL3G7qFZCDO4tIXzfYcoyBzssKRInECGwMQiNN5Nq2wwpqB5AOARqAovehWxtdOOdqbzx/i8uAJRq/TcjbXCKlD1EfrxcHwojy5K5WQSsC/Nc73RvYwJ7kEYRaoLf6zPGWvNzYbKpo0eDWaCwbZcfVgcPTsRduR55qyiX2cOf2h/TeVbG71cSO3qpZ/XCBpzfvXq0+Zm0uWYHbSFJO4LXwZmu2CbwBn88F0viQ/MASSgiGW8cWmWScv1kDJ8mA2dBRgnwLk76O6xBDmamCfvXwVPwo1wsarDcnTI+BwCHtgQtWhzWOKgZFUoPt07Dr2VzGYRp1lcqy3IJe3Q== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(136003)(376002)(36840700001)(46966006)(5660300002)(36860700001)(336012)(82310400003)(4326008)(6666004)(426003)(26005)(186003)(8936002)(2616005)(356005)(7416002)(36756003)(47076005)(107886003)(2906002)(1076003)(36906005)(83380400001)(7636003)(6916009)(316002)(478600001)(70586007)(70206006)(82740400003)(86362001)(7696005)(8676002)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2021 15:36:41.2184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4bfec1a-2249-43d8-6ad7-08d8f9daf0ef X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0049 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Action init code increments reference counter when it changes an action. This is the desired behavior for cls API which needs to obtain action reference for every classifier that points to action. However, act API just needs to change the action and releases the reference before returning. This sequence breaks when the requested action doesn't exist, which causes act API init code to create new action with specified index, but action is still released before returning and is deleted (unless it was referenced concurrently by cls API). Reproduction: $ sudo tc actions ls action gact $ sudo tc actions change action gact drop index 1 $ sudo tc actions ls action gact Extend tcf_action_init() to accept 'init_res' array and initialize it with action->ops->init() result. In tcf_action_add() remove pointers to created actions from actions array before passing it to tcf_action_put_many(). Fixes: cae422f379f3 ("net: sched: use reference counting action init") Reported-by: Kumar Kartikeya Dwivedi Signed-off-by: Vlad Buslov --- Notes: Changes V1 -> V2: - Extend commit message with reproduction and fix details. - Don't extend tcf_action_put_many() with action filtering. Filter actions array in caller instead. include/net/act_api.h | 5 +++-- net/sched/act_api.c | 22 +++++++++++++++------- net/sched/cls_api.c | 9 +++++---- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 2bf3092ae7ec..312f0f6554a0 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -185,7 +185,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, int nr_actions, struct tcf_result *res); int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct tc_action *actions[], size_t *attr_size, + struct tc_action *actions[], int init_res[], size_t *attr_size, bool rtnl_held, struct netlink_ext_ack *extack); struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, bool rtnl_held, @@ -193,7 +193,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct tc_action_ops *ops, bool rtnl_held, + struct tc_action_ops *a_o, int *init_res, + bool rtnl_held, struct netlink_ext_ack *extack); int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind, int ref, bool terse); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index b919826939e0..50854cfbfcdb 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -992,7 +992,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct tc_action_ops *a_o, bool rtnl_held, + struct tc_action_ops *a_o, int *init_res, + bool rtnl_held, struct netlink_ext_ack *extack) { struct nla_bitfield32 flags = { 0, 0 }; @@ -1028,6 +1029,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, } if (err < 0) goto err_out; + *init_res = err; if (!name && tb[TCA_ACT_COOKIE]) tcf_set_action_cookie(&a->act_cookie, cookie); @@ -1056,7 +1058,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct tc_action *actions[], size_t *attr_size, + struct tc_action *actions[], int init_res[], size_t *attr_size, bool rtnl_held, struct netlink_ext_ack *extack) { struct tc_action_ops *ops[TCA_ACT_MAX_PRIO] = {}; @@ -1084,7 +1086,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind, - ops[i - 1], rtnl_held, extack); + ops[i - 1], &init_res[i - 1], rtnl_held, + extack); if (IS_ERR(act)) { err = PTR_ERR(act); goto err; @@ -1497,12 +1500,13 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, struct netlink_ext_ack *extack) { size_t attr_size = 0; - int loop, ret; + int loop, ret, i; struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; + int init_res[TCA_ACT_MAX_PRIO] = {}; for (loop = 0; loop < 10; loop++) { ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, - actions, &attr_size, true, extack); + actions, init_res, &attr_size, true, extack); if (ret != -EAGAIN) break; } @@ -1510,8 +1514,12 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, if (ret < 0) return ret; ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); - if (ovr) - tcf_action_put_many(actions); + + /* only put existing actions */ + for (i = 0; i < TCA_ACT_MAX_PRIO; i++) + if (init_res[i] == ACT_P_CREATED) + actions[i] = NULL; + tcf_action_put_many(actions); return ret; } diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 9332ec6863e8..9ecb91ebf094 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -3040,6 +3040,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, { #ifdef CONFIG_NET_CLS_ACT { + int init_res[TCA_ACT_MAX_PRIO] = {}; struct tc_action *act; size_t attr_size = 0; @@ -3051,8 +3052,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, return PTR_ERR(a_o); act = tcf_action_init_1(net, tp, tb[exts->police], rate_tlv, "police", ovr, - TCA_ACT_BIND, a_o, rtnl_held, - extack); + TCA_ACT_BIND, a_o, init_res, + rtnl_held, extack); if (IS_ERR(act)) { module_put(a_o->owner); return PTR_ERR(act); @@ -3067,8 +3068,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, err = tcf_action_init(net, tp, tb[exts->action], rate_tlv, NULL, ovr, TCA_ACT_BIND, - exts->actions, &attr_size, - rtnl_held, extack); + exts->actions, init_res, + &attr_size, rtnl_held, extack); if (err < 0) return err; exts->nr_actions = err; From patchwork Wed Apr 7 15:36:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Buslov X-Patchwork-Id: 418060 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 E5A1DC433B4 for ; Wed, 7 Apr 2021 15:36:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C20066112F for ; Wed, 7 Apr 2021 15:36:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343949AbhDGPg5 (ORCPT ); Wed, 7 Apr 2021 11:36:57 -0400 Received: from mail-mw2nam08on2078.outbound.protection.outlook.com ([40.107.101.78]:20703 "EHLO NAM04-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243477AbhDGPg4 (ORCPT ); Wed, 7 Apr 2021 11:36:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EaXiBWTk/7CrLYtJ+K4JALjNMHH4rLPLlJ/11ftj+rJvTXkVbtUh9YhbYjl8ufFaDw30U03u1HIoRW7CE8qRjWQnGYNoLYIhegB2d6PPZL8CNTApHiBKpN/pDpkyuMs2uDikY3jpFb0vq4uCnSo8TAYdemk1378yUJZPp8JlGPxNTG1OUyEXOSfdswKUbSFCaTXAd5szntmfEpbuh+uL8xijLVvdmJPF7mU8iFtgR5wCP9V5/BbH60+u/NzwWjg3YgypSwe5/JdTGpxrtCGV2Xe8X7318QxvTnWwlalWIfPUZL9C8XYCLqENDOMMDmYPY04RF9Ktvao4l6EoKwtaHg== 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-SenderADCheck; bh=xmWydUf+44kvoIH9/txTnHZ6z6jdMNGj74ia5GMzEW0=; b=JPKCQH6uhMf1fGKj0OuTg2+oJqhkVEIIVopTBL4iTavaU9OeuCV4f8G+c4YiTUu193ChrEivFZVeeu1/4qvUYGH691e/Stt7w1YveJZIjbxgj+FEld7tXAw9iKy+s51707mk7Tm/jN25wnIAzOd1ULhd7vyJHS6v9TUcjYwLdC9AFlpLuzOmmsxcFJLNxgvAKDr/TsbmgFfbd5+UcKX6qimULdAcRXyn/l+YZ4FCEje62X71PQqIk2g4r0o6SRoUnwW8+gDV857JIBx+t9fLH2GRy3HKcma3xGHB+iqb0g9eC5PeJ+JA35awt83vTGUn1a03nP/f3kTZ29nswpzkWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xmWydUf+44kvoIH9/txTnHZ6z6jdMNGj74ia5GMzEW0=; b=oCr63lj5+4odLu4Q0hlzbcby2yzt4EY4c/YUwmxYE6tuRE4bvdXtNqTVcikccru4f7xr++iES1LabQdHGasb6zBZ9l+EIMPD/714n39zS9RYD4pm0qNVmbMdJFQ4Qe6bMPGHFLT+tfDXn/kfe81ibxyflmlo7uLVS1PneAjUInL3/2VVeQnzWYvb+1pS3zZ2G9UdhvXDmDNZztk6972zVg2mIVDJ0/1XV4tbPjqN+90I65pG6djJ/vhe7m8IBSp0VoNgTU2bgIuYG3Ng+aXd76/Tqd0/7omn4y+0nYe6uAt68//7JvfEQ5EmOt/QyQP7NZy2Ye1AFNpl51AOCYqPzA== Received: from MW4PR03CA0275.namprd03.prod.outlook.com (2603:10b6:303:b5::10) by BY5PR12MB3747.namprd12.prod.outlook.com (2603:10b6:a03:1ac::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Wed, 7 Apr 2021 15:36:45 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::d3) by MW4PR03CA0275.outlook.office365.com (2603:10b6:303:b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 15:36:44 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Apr 2021 15:36:43 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 7 Apr 2021 15:36:41 +0000 From: Vlad Buslov To: CC: , , , , , , , , , Vlad Buslov Subject: [PATCH net v2 3/3] net: sched: fix err handler in tcf_action_init() Date: Wed, 7 Apr 2021 18:36:04 +0300 Message-ID: <20210407153604.1680079-4-vladbu@nvidia.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210407153604.1680079-1-vladbu@nvidia.com> References: <20210407153604.1680079-1-vladbu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09cb1fef-c764-4150-f713-08d8f9daf308 X-MS-TrafficTypeDiagnostic: BY5PR12MB3747: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:785; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oKBB1nubJhNZfM7mMFZ0ojo8HL5S/z+TlgxwilIpEVZqI9ic3FsGI8O02kvqxnLSgnmtGLYyPpOL4m2xo8IONEy7iIx/P9Hg9GWyGUZO2z7uC59BZ8yC5V2CQ6AztMLaCwSQI4dSIAZ0IejhUvf8EP1CNGLn6DtgzFEr3v6sCuSIyeU+LzuKP/3TYrQa//BQVH+uLg8OvacXTr3DYFUlc87k0oJApcPR7Au2iUUrW3iEt53YKjyHGnLGIsNteDLe/WBg9qCK46gMKGXkcgc157RzgXbjywkZtk7RCizr82cX0Dyd3MYNjDY1uY6R1GNaputBYetNKq8O0MV9WF9bpLT3YWEERGJ4fznAqBm+ijSmHrXaFSutjjOHDIP7Y95O5PiuXi77qvVKlaUj2+UZWpGM0G5KZan49QT9RwFU8uWcHRK59MolTIu23xMqc9fF9BL/EAduUWlcEUJ5qSRUhh+asO7GEjyIwaYgWbPewnSGRKQBEJCXQMoBDvoWyk/C9sJ9ceM2rDh3OIFPlZk+R8EIIHDGpF1O4pBj59VlXCeDtGuR2ED2v6OCywzZjhwBBmf08cfad/s5oh23LTTgZ4gKNZvuA3Ve2msN3Ys35s7XKKVoaE9PKCA++W4bwUPORAW6pjJ3kLSF96BIUswvK1bXVNR2Rs0QheEAVIig8uI= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(136003)(376002)(46966006)(36840700001)(7696005)(1076003)(6666004)(36906005)(478600001)(8676002)(82740400003)(54906003)(316002)(426003)(7636003)(83380400001)(5660300002)(70586007)(70206006)(336012)(356005)(7416002)(86362001)(8936002)(6916009)(26005)(2906002)(4326008)(47076005)(2616005)(107886003)(36756003)(82310400003)(36860700001)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2021 15:36:44.7453 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09cb1fef-c764-4150-f713-08d8f9daf308 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3747 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With recent changes that separated action module load from action initialization tcf_action_init() function error handling code was modified to manually release the loaded modules if loading/initialization of any further action in same batch failed. For the case when all modules successfully loaded and some of the actions were initialized before one of them failed in init handler. In this case for all previous actions the module will be released twice by the error handler: First time by the loop that manually calls module_put() for all ops, and second time by the action destroy code that puts the module after destroying the action. Reproduction: $ sudo tc actions add action simple sdata \"2\" index 2 $ sudo tc actions add action simple sdata \"1\" index 1 \ action simple sdata \"2\" index 2 RTNETLINK answers: File exists We have an error talking to the kernel $ sudo tc actions ls action simple total acts 1 action order 0: Simple <"2"> index 2 ref 1 bind 0 $ sudo tc actions flush action simple $ sudo tc actions ls action simple $ sudo tc actions add action simple sdata \"2\" index 2 Error: Failed to load TC action module. We have an error talking to the kernel $ lsmod | grep simple act_simple 20480 -1 Fix the issue by modifying module reference counting handling in action initialization code: - Get module reference in tcf_idr_create() and put it in tcf_idr_release() instead of taking over the reference held by the caller. - Modify users of tcf_action_init_1() to always release the module reference which they obtain before calling init function instead of assuming that created action takes over the reference. - Finally, modify tcf_action_init_1() to not release the module reference when overwriting existing action as this is no longer necessary since both upper and lower layers obtain and manage their own module references independently. Fixes: d349f9976868 ("net_sched: fix RTNL deadlock again caused by request_module()") Suggested-by: Cong Wang Signed-off-by: Vlad Buslov --- Notes: Changes V1 -> V2: - Reimplement the fix to unconditionally release action module references in action create code and modify action idr create/release to manually get/put module reference instead of taking over the reference held by the caller (Cong Wang). include/net/act_api.h | 7 +------ net/sched/act_api.c | 26 ++++++++++++++++---------- net/sched/cls_api.c | 5 ++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 312f0f6554a0..086b291e9530 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -170,12 +170,7 @@ void tcf_idr_insert_many(struct tc_action *actions[]); void tcf_idr_cleanup(struct tc_action_net *tn, u32 index); int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index, struct tc_action **a, int bind); -int __tcf_idr_release(struct tc_action *a, bool bind, bool strict); - -static inline int tcf_idr_release(struct tc_action *a, bool bind) -{ - return __tcf_idr_release(a, bind, false); -} +int tcf_idr_release(struct tc_action *a, bool bind); int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); int tcf_unregister_action(struct tc_action_ops *a, diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 50854cfbfcdb..f6d5755d669e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -158,7 +158,7 @@ static int __tcf_action_put(struct tc_action *p, bool bind) return 0; } -int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) +static int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) { int ret = 0; @@ -184,7 +184,18 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) return ret; } -EXPORT_SYMBOL(__tcf_idr_release); + +int tcf_idr_release(struct tc_action *a, bool bind) +{ + const struct tc_action_ops *ops = a->ops; + int ret; + + ret = __tcf_idr_release(a, bind, false); + if (ret == ACT_P_DELETED) + module_put(ops->owner); + return ret; +} +EXPORT_SYMBOL(tcf_idr_release); static size_t tcf_action_shared_attrs_size(const struct tc_action *act) { @@ -493,6 +504,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, } p->idrinfo = idrinfo; + __module_get(ops->owner); p->ops = ops; *a = p; return 0; @@ -1037,13 +1049,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, if (!name) a->hw_stats = hw_stats; - /* module count goes up only when brand new policy is created - * if it exists and is only bound to in a_o->init() then - * ACT_P_CREATED is not returned (a zero is). - */ - if (err != ACT_P_CREATED) - module_put(a_o->owner); - return a; err_out: @@ -1103,7 +1108,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, tcf_idr_insert_many(actions); *attr_size = tcf_action_full_attrs_size(sz); - return i - 1; + err = i - 1; + goto err_mod; err: tcf_action_destroy(actions, bind); diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 9ecb91ebf094..340d5af86e87 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -3054,10 +3054,9 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, rate_tlv, "police", ovr, TCA_ACT_BIND, a_o, init_res, rtnl_held, extack); - if (IS_ERR(act)) { - module_put(a_o->owner); + module_put(a_o->owner); + if (IS_ERR(act)) return PTR_ERR(act); - } act->type = exts->type = TCA_OLD_COMPAT; exts->actions[0] = act;