summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-08-24 09:39:02 -0700
committerBen Hutchings <ben@decadent.org.uk>2016-11-20 01:17:17 +0000
commit3b27f2aec927db87c671c125867a8e4f3d7dce07 (patch)
tree1bed88357986378c6c1cdbaaf29585cd59e1d74d
parent2c825d45170c36bda7472c6ee263e17eb3101849 (diff)
downloadlinux-stable-3b27f2aec927db87c671c125867a8e4f3d7dce07.tar.gz
linux-stable-3b27f2aec927db87c671c125867a8e4f3d7dce07.tar.bz2
linux-stable-3b27f2aec927db87c671c125867a8e4f3d7dce07.zip
qdisc: fix a module refcount leak in qdisc_create_dflt()
commit 166ee5b87866de07a3e56c1b757f2b5cabba72a5 upstream. 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> Acked-by: John Fastabend <john.r.fastabend@intel.com> Acked-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--net/sched/sch_generic.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index e1543b03e39d..c0bdd3bce189 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -590,18 +590,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);