Subject: Re: [PATCH net] net: sched: fix possible refcount leak in tc_chain_tmplt_add()

From: Simon Horman <[email-masked]>
Date: Tue, 6 Jun 2023 11:33:36 +0200

On Tue, Jun 06, 2023 at 10:13:44AM +0800, Hangyu Hua wrote:
> On 5/6/2023 20:31, Simon Horman wrote:
> > 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.
> > 
> > Hi Hangyu Hua,
> > 
> > Is this correct even if try_module_get() is
> > not called via tcf_proto_lookup_ops() ?
> > 
> 
> tcf_proto_lookup_ops will return error if try_module_get() is not called in
> tcf_proto_lookup_ops(). I am not sure what you mean?

Thanks,

I think that answers my question.

My concern was if there is a situation where module_put() is
now called, but there was not in fact a reference that should
be released.

...