Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6979739rwd; Tue, 6 Jun 2023 04:59:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KhAta0HT/wPuXsyz7xUb/YArFGBv7QCrzgIwiPp1oamXqZF7OnbGRqnUN146Cjgd9/pOP X-Received: by 2002:a05:6214:d4e:b0:621:2478:f75a with SMTP id 14-20020a0562140d4e00b006212478f75amr1909089qvr.45.1686052791536; Tue, 06 Jun 2023 04:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686052791; cv=none; d=google.com; s=arc-20160816; b=gKJLStLtFj/x1OOCpFJJV5IAlw02E4pxnwZR0WV4eegjWR0j5t14JlzYPijT0g5lrc Cet0I7yWFN32aXXxz37/2rgt/vM45fvPj6UJi+9jM/VJyQCAUyRJUIXvNmK+DU6J9hLA 3ZG0S1ED9CWFc1/fsyVbfXeybu8+AxZovUGtUHpX5ECFgY3RgFALi3E/m4d8osr4KQ1p izzK5tYJJE76ulRlq8WhhoEmryEu7jLrsZjah8JU/CDWUsSS0rz5XEhr+Mfohn5KLhpo MOUAa99MPhAHCk3pFE/yh8pd5dMXrLhIjmnhL5mTyAo78R7Lj4O3UhHu629Czn1XrGtc PInw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WgEiERv4Bqd8wYQ9qGd58dje1mGdDZnpS8Q33NIZosE=; b=cvgQSo5R9dGWEWcvtsIpipfJB5cW2+xzOJfZl/kW4yox2/1uJKxpA4cRWnUXIJsrTv BW2bus72uaErZQ1jtC+uc9Rqg6V+bEDHHNa3ABrb+17u9JVsFHhsOAvJZWQXGo2n5Z/S 5H72NtO0tcTaP0/oYDEh61mZDgbtkPe+r1sBmQgSQdsQ7dAWNyKmCo8NUAGaPzWAxO50 cwOnUdK2kndP6wdm1O9CAbdm4Dx3CavQSjVgZndo8g1/5X/2df0jpdIeEGxfQUAPNlwi LA9Vbg8ZWlMzo4szeWVVZbNTk68laywxFRf0Sc4rOG0FXVQpA/i/2S6fvLyUkQ33eXEh On1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20221208.gappssmtp.com header.s=20221208 header.b=wnxII4xg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kc7-20020a056214410700b0056ea7340b30si6158154qvb.177.2023.06.06.04.59.37; Tue, 06 Jun 2023 04:59:51 -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=@resnulli-us.20221208.gappssmtp.com header.s=20221208 header.b=wnxII4xg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234566AbjFFLVU (ORCPT + 99 others); Tue, 6 Jun 2023 07:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbjFFLVS (ORCPT ); Tue, 6 Jun 2023 07:21:18 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55577E55 for ; Tue, 6 Jun 2023 04:21:16 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-514924b4f8cso9150633a12.3 for ; Tue, 06 Jun 2023 04:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20221208.gappssmtp.com; s=20221208; t=1686050475; x=1688642475; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WgEiERv4Bqd8wYQ9qGd58dje1mGdDZnpS8Q33NIZosE=; b=wnxII4xg6UhjdYQWVBrx+4Svi6hEZiufrEz1S2U8BuPUtzZHyEWdQmhCihcqZd1skY 8LReU2JOhUXSaM7xm0VEdSDS195XArVE04Rht8GJzldSHrTfKIi7boRXiE3SeFexl66b K4CE685yHVi56qYK7JL04MBjZFUQtqDGLzt6GUMGwQnsDTDLdM29ZKJ/2VBcz5h8ZRqM AgI6efazcDIQGrMut8pLeVwwCIcVNTqeGsoFE7mqlnCWxSxetrfoigrrqgHUNXZkv1dp Ylhpggwz8/IWa94OQbrCMMJPA5KivrOjvysN0WT0NNRac3Y/9b9N+X5CXnHMV5ogRDK2 aP2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686050475; x=1688642475; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WgEiERv4Bqd8wYQ9qGd58dje1mGdDZnpS8Q33NIZosE=; b=Lav7au9/+NFtig19wCPQ/1PmMBGXYPqE65N+LO1FOh9YKstm1wXdq6HItSQwzJSNNj XoZsVgzymgKTKx7pIww7fjpKjKyRQoO+h+N1vaUPmgrdGc8ETbwyiFyOnU8BA1V9puKR /vR9CFIJuFEAnaRQJR1rKRqqwuQRznkovCFJJJRWf4KWk2qknoJobRPw7rI54SXOMf8f ZqjfRrXdHUUm2Hp+bW2u3N5mJg/pLNElwwg9ZsNfdCIMxePirSwEdmcnn9Xp9ufwdqwi 949O1zZaXSVoUcEibhVbNvohGVcVlgdz+bVjq0LRMiKO/a+bOWfSG3qQAoTDbaUmMV49 0HOg== X-Gm-Message-State: AC+VfDwAB7rWlcz5wXWPJ608bOo+k8bwc9WeL/1Jv2WwCTwz6yrQiOIn KGNXYtVPyYS1PPp4KFwaAm1qNg== X-Received: by 2002:a17:907:8a08:b0:973:ad8f:ef9b with SMTP id sc8-20020a1709078a0800b00973ad8fef9bmr2301783ejc.5.1686050474742; Tue, 06 Jun 2023 04:21:14 -0700 (PDT) Received: from localhost (host-213-179-129-39.customer.m-online.net. [213.179.129.39]) by smtp.gmail.com with ESMTPSA id v3-20020a1709063bc300b0096650f46004sm5412062ejf.56.2023.06.06.04.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 04:21:13 -0700 (PDT) Date: Tue, 6 Jun 2023 13:21:12 +0200 From: Jiri Pirko To: Hangyu Hua Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: sched: fix possible refcount leak in tc_chain_tmplt_add() Message-ID: References: <20230605070158.48403-1-hbh25y@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230605070158.48403-1-hbh25y@gmail.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Mon, Jun 05, 2023 at 09:01:58AM CEST, hbh25y@gmail.com 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. Who's "we"? Use imperative mood. Tell the codebase what to do, what to change, etc. Code-wise, this is fine. Please fix the patch description. > >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 >