lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1472136361.14381.132.camel@edumazet-glaptop3.roam.corp.google.com>
Date:   Thu, 25 Aug 2016 07:46:01 -0700
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Wei Yongjun <weiyj.lk@...il.com>
Cc:     David Miller <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        John Fastabend <john.fastabend@...il.com>,
        stephen hemminger <stephen@...workplumber.org>,
        Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [PATCH net] qdisc: fix a module refcount leak in
 qdisc_create_dflt()

On Thu, 2016-08-25 at 21:26 +0800, Wei Yongjun wrote:
> On 08/25/2016 12:39 AM, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com>
> >
> > Should qdisc_alloc() fail, we must release the module refcount
> > we got right before.
> >
> > Fixes: 6da7c8fcbcbd ("qdisc: allow setting default queuing discipline")
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > ---
> >  net/sched/sch_generic.c |    9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
> > index e95b67cd5718..657c13362b19 100644
> > --- a/net/sched/sch_generic.c
> > +++ b/net/sched/sch_generic.c
> > @@ -643,18 +643,19 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
> >  	struct Qdisc *sch;
> >  
> >  	if (!try_module_get(ops->owner))
> > -		goto errout;
> > +		return NULL;
> >  
> >  	sch = qdisc_alloc(dev_queue, ops);
> > -	if (IS_ERR(sch))
> > -		goto errout;
> > +	if (IS_ERR(sch)) {
> > +		module_put(ops->owner);
> > +		return NULL;
> > +	}
> >  	sch->parent = parentid;
> >  
> >  	if (!ops->init || ops->init(sch, NULL) == 0)
> >  		return sch;
> >  
> >  	qdisc_destroy(sch);
> 
> ops->init() failed, missing module_put() here.

qdisc_destroy() is doing this for us, we do not want to have a double
module_put()



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ