All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	stephen hemminger <stephen@networkplumber.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [PATCH net] qdisc: fix a module refcount leak in qdisc_create_dflt()
Date: Wed, 24 Aug 2016 10:14:32 -0700	[thread overview]
Message-ID: <57BDD5F8.5080702@gmail.com> (raw)
In-Reply-To: <1472056742.14381.93.camel@edumazet-glaptop3.roam.corp.google.com>

On 16-08-24 09:39 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.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@google.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);
> -errout:
>  	return NULL;
>  }
>  EXPORT_SYMBOL(qdisc_create_dflt);
> 
> 

Thanks!

Acked-by: John Fastabend <john.r.fastabend@intel.com>

  parent reply	other threads:[~2016-08-24 17:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 16:39 [PATCH net] qdisc: fix a module refcount leak in qdisc_create_dflt() Eric Dumazet
2016-08-24 17:13 ` John Fastabend
2016-08-24 17:14 ` John Fastabend [this message]
2016-08-25 13:26 ` Wei Yongjun
2016-08-25 14:46   ` Eric Dumazet
2016-08-25 23:44 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57BDD5F8.5080702@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.