From: Wei Yongjun <weiyj.lk@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
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: Thu, 25 Aug 2016 21:26:59 +0800 [thread overview]
Message-ID: <ef703076-2e2c-3373-53b1-99ba5df2c2d5@gmail.com> (raw)
In-Reply-To: <1472056742.14381.93.camel@edumazet-glaptop3.roam.corp.google.com>
On 08/25/2016 12: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);
ops->init() failed, missing module_put() here.
> -errout:
> return NULL;
> }
> EXPORT_SYMBOL(qdisc_create_dflt);
>
>
> .
>
next prev parent reply other threads:[~2016-08-25 13:41 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
2016-08-25 13:26 ` Wei Yongjun [this message]
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=ef703076-2e2c-3373-53b1-99ba5df2c2d5@gmail.com \
--to=weiyj.lk@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jhs@mojatatu.com \
--cc=john.fastabend@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).