mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 07:00:48 +00:00
qdisc: fix a module refcount leak in qdisc_create_dflt()
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>
This commit is contained in:
parent
a5de125dd4
commit
166ee5b878
@ -643,18 +643,19 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
|
|||||||
struct Qdisc *sch;
|
struct Qdisc *sch;
|
||||||
|
|
||||||
if (!try_module_get(ops->owner))
|
if (!try_module_get(ops->owner))
|
||||||
goto errout;
|
return NULL;
|
||||||
|
|
||||||
sch = qdisc_alloc(dev_queue, ops);
|
sch = qdisc_alloc(dev_queue, ops);
|
||||||
if (IS_ERR(sch))
|
if (IS_ERR(sch)) {
|
||||||
goto errout;
|
module_put(ops->owner);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
sch->parent = parentid;
|
sch->parent = parentid;
|
||||||
|
|
||||||
if (!ops->init || ops->init(sch, NULL) == 0)
|
if (!ops->init || ops->init(sch, NULL) == 0)
|
||||||
return sch;
|
return sch;
|
||||||
|
|
||||||
qdisc_destroy(sch);
|
qdisc_destroy(sch);
|
||||||
errout:
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(qdisc_create_dflt);
|
EXPORT_SYMBOL(qdisc_create_dflt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user