Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6829322rwd; Tue, 6 Jun 2023 02:30:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5yR7bwgu1Y0Izza8bwvxnNBhgGo2VhyCDFO4yfgkIEdms+YNaNohCPqjl5zy2f2Tyisl88 X-Received: by 2002:a05:620a:4409:b0:75c:cc9f:1e3f with SMTP id v9-20020a05620a440900b0075ccc9f1e3fmr1497857qkp.4.1686043859534; Tue, 06 Jun 2023 02:30:59 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020ae9f50b000000b0075bbc2ff3e2si5660491qkg.571.2023.06.06.02.30.45; Tue, 06 Jun 2023 02:30:59 -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=@intel.com header.s=Intel header.b=cMV2UDbu; arc=fail (signature failed); 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237261AbjFFI5Z (ORCPT + 99 others); Tue, 6 Jun 2023 04:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237349AbjFFI5R (ORCPT ); Tue, 6 Jun 2023 04:57:17 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E627E76; Tue, 6 Jun 2023 01:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686041833; x=1717577833; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Va6H68SXQsSGup5D/E85THfMfsgPCyLFJOQoTfRDasc=; b=cMV2UDbujIQhkLBGKFVnFpiTA19rnEju/HTHyrVbLnSmDZasRpO91PaH kRkYSV61364BIS5PA+KlDGA0Y3Qc4PJIXIffE0XfLdIvg6NFx/nmB9QYi i5hd2z+ZS4c4oNy2GcGSYMsk9TzkGGxl9a8skr9VZupVoeuyzldfFQXtc 2wo8gDE+3RFH0lgslyW1BY5ekEBj4ltFDz/kvp0uQ4/CTeQMK0WJvk5rP +pIEM6o9TxZeGpkvPchxz2S6JdsfxIml7/2uRyXcnU4bc56EuyD3J3CFK uwZyXxAOheDhcwhuXDvW5udj35S1hFrMWnNbWHwy4GqlO6VegrOSPfXSc Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="356618892" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="356618892" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2023 01:56:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="659435896" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="659435896" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga003.jf.intel.com with ESMTP; 06 Jun 2023 01:56:51 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 6 Jun 2023 01:56:50 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 6 Jun 2023 01:56:50 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Tue, 6 Jun 2023 01:56:50 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 6 Jun 2023 01:56:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oJhD16VdXJCRmZXWWSuWpjKVL5AHrRUfCaKQabK9kQUVCXw3n0nw/LACRBdaSGJTzmDz6XDY0aa9iRqK0QFUYex31CoTMZEn5Zql3R4mnP0yWP0PkNdZut7zuiuYO769l53NanKlsoiFwhAnk84vE4L+q0q5xtH1uwiCFQnriFT9lAC4OliJC/NSZ/+j7O6MA3xGmFLpbaA2JWjluTQkCYrbcVNSCh96IwcRwkS/bzHtEeUe4xdj1eOtkV5upUosvHVwq1raWhGqL1wdvJfgxkikJAcaPoFXjE/D8/8PgJcXyfPZKFCzkTEuqXJEJNhrlaW/uO28WZaEUcEc7InwGg== 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=xmqF29KecM67z0kONfU3oX6pgwaAy1lXTJDySsoWbys=; b=gM2Ewmj6O2/Af1jWzyvPW7zqn6XNwSbmUqgFuSFXM+ct1V20e5NhY0E/82oaZwnEp6uIRFtoTFOtrLReLe6AIZVe5cPsiWK2UIhCKh3V3jFq8o0zheJYXep+gUc0VFj6NqiNUjzaIrWavIGjtJFXfrmBi0Nwc+wlUvy15vjacGShGS/Wv4ndR3k1BwUbet7FgsFJ5ftQoWIuUs5FS8LXYFEG7V9tzx0y3fAPZYGtY/VPF+YSFRQU5LwIezsssSVRMZYoFXKC+aanWUVjhPF/3fOBEBJN9zJ8CEcze3WnuGSdmwTUwjZ3wt4ceB+zSP7bOuizZ2AQJFqarU/duk1ggQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SN7PR11MB7540.namprd11.prod.outlook.com (2603:10b6:806:340::7) by SA2PR11MB5083.namprd11.prod.outlook.com (2603:10b6:806:11b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 08:56:48 +0000 Received: from SN7PR11MB7540.namprd11.prod.outlook.com ([fe80::9376:9c9d:424a:a0fe]) by SN7PR11MB7540.namprd11.prod.outlook.com ([fe80::9376:9c9d:424a:a0fe%5]) with mapi id 15.20.6455.030; Tue, 6 Jun 2023 08:56:48 +0000 Date: Tue, 6 Jun 2023 10:53:55 +0200 From: Larysa Zaremba To: Hangyu Hua CC: , , , , , , , , Subject: Re: [PATCH net] net: sched: fix possible refcount leak in tc_chain_tmplt_add() Message-ID: References: <20230605070158.48403-1-hbh25y@gmail.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230605070158.48403-1-hbh25y@gmail.com> X-ClientProxiedBy: DB7PR05CA0057.eurprd05.prod.outlook.com (2603:10a6:10:2e::34) To SN7PR11MB7540.namprd11.prod.outlook.com (2603:10b6:806:340::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN7PR11MB7540:EE_|SA2PR11MB5083:EE_ X-MS-Office365-Filtering-Correlation-Id: bcd016b1-702c-49d8-5789-08db666bf63e X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T8CgHoOLZmQALcDTL66n0EhJc5adS8sydOgcVr/wt8boqn8h8KKK5k5cOfg06WLZTvf9Op3FysTHbptjK4mSRb4qYA2LsnEIo88pgnG3jyiWQeRKjD8c+M4nuBKPfhn5cI4SjEcshvxTeM+jk3OB7dXyj24axJRkt700jiPaIaw7IxkAlNtbs6a08ko48TRaCyCUkJwBERjZSt9tNzKv0sdbZFVJrEvZ8j4DfdEWktvM4Y0f8RGMfFlYTMxlbC9vPvMlJGN4kZkSt6CvJw/fkNz27gnUAJYPBjEAlTU5xZAoXirAjUHOBSIzuxp6RSxFtV54xR954TC9v9JvmqgHVWprZvo8qEz6eroegNTElNo/rNFR2Dg19loeB9/r8jIg6HDBkEertTbygQYLyjQ09sGApkRx/4pTbTuaRwbL32HuQEzaUtI8extUPQdCAbK73PLnol4YDKn5PTdRUGzCERVOM6Al5nULLukAy1H5x6IO4fvrFOJwM1K5uZVm2bcXR8+UlYXYRv6anR0te3w0My9WYc+HK0JqWO5LmxgqBxQUpoizDN4zlvFaOOy3o/pm36DkmNc2dvEspDVwrAeRzl3RBm0DoPPjPckMlsXpheQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR11MB7540.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(396003)(39860400002)(136003)(376002)(366004)(346002)(451199021)(6486002)(6666004)(9686003)(6512007)(6506007)(26005)(83380400001)(186003)(86362001)(316002)(7416002)(44832011)(66946007)(66556008)(66476007)(4326008)(6916009)(5660300002)(8936002)(8676002)(2906002)(33716001)(82960400001)(41300700001)(478600001)(38100700002)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7fM/OvcPhw1PHUO3drzhc0denhR4ozCXTBDFx0xjNd00AVspjTrKll5R4oPH?= =?us-ascii?Q?jyvEBpFwnWWpq5Il1iK76FDihw4+JvaDcCUJ8XRpECbhFnitnYVEsGtBD4an?= =?us-ascii?Q?nDtb7l7hp3KeRa3ze9dHnlYsc+RjE/9XkEFriFsMTX100OP+0DY2jGS1E/Ft?= =?us-ascii?Q?1WnJ/cEQ3nmPMXyewDTg5K8gpOMjrZfCFH8bA3vt5eqkaXyyy5+RghRIThDT?= =?us-ascii?Q?wjg+RTnPla/VBEiw9Tz5SxBGfdMdWkhkhULg5gO5/qqD8J5YJDDnKE8xvnu7?= =?us-ascii?Q?4f/WAM4N5jm79od+Qkor6Gl1CxcpOsjlikXAg9z4wDShqFN3EDnFrO+gNDfa?= =?us-ascii?Q?F8tCNaUzY/MiePf62limBccr01xwMppmuW77vG3NVT/c5iEcH4Ctm/5Ls3CK?= =?us-ascii?Q?h2PWlvF+ijBPciKF2qSUVULVKoP+0fwZP4PUcD2iV54MwPOwE0ohGD5HkBW5?= =?us-ascii?Q?mK0cjj1jaVzS4mE7JJ7OaWuCDlVABNzg/SDl2xcwFBgGO2V0tjI9eoEleryT?= =?us-ascii?Q?XG2+q14FG0dKxeakCW6WlHERbwoizBZXMPl2byeufTNsGqocQ7inUZgJbJy0?= =?us-ascii?Q?qXRz6ZN6s9JOn1MG0UnxH/VTq3yl4qJdTpBIfOm3+2vyOa7GD8T4V5mg7zhM?= =?us-ascii?Q?3tgCTdeyyUt7A/SgZ3ewLS8yrJaHvOfxCe1HwGJbak93LFwNXWX4VzzyiZla?= =?us-ascii?Q?cmhB8IFY1nlej9JG311UbLGfIlgoGKYv6j79e91agmvt7eV8UXaCd/5ADWxH?= =?us-ascii?Q?8T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Id: bcd016b1-702c-49d8-5789-08db666bf63e X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB7540.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 08:56:48.3187 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: myivvvkRKNqBrgtNVJ2jk7CTqusJsgp45WJk1yWevmtqqZI+LZiqI0DoNX2QQc8Mg1PPC9tGT1afV/BL5KIhwpRiwUBQ/NgJJsmDff7t7/A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5083 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 Mon, Jun 05, 2023 at 03:01:58PM +0800, Hangyu Hua wrote: > try_module_get can be called in tcf_proto_lookup_ops. So if ops don't > implement the corresponding function we should call module_put to drop > the refcount. > Code seems reasonable. But commit message is pretty hard to understand. Please, replace "corresponding" with "required". Also change the first sentence, do not use "can". From what I see, successful execution of tcf_proto_lookup_ops always means we now hold reference to module. CC me in v2, I'll give you Reviewed-by. > Fixes: 9f407f1768d3 ("net: sched: introduce chain templates") > Signed-off-by: Hangyu Hua > --- > 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 2621550bfddc..92bfb892e638 100644 > --- a/net/sched/cls_api.c > +++ b/net/sched/cls_api.c > @@ -2952,6 +2952,7 @@ static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, > return PTR_ERR(ops); > if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) { > NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); > + module_put(ops->owner); > return -EOPNOTSUPP; > } > > -- > 2.34.1 > >