Skip to content

Commit 0fbbeb1

Browse files
tgrafdavem330
authored andcommitted
[PKT_SCHED]: Fix missing qdisc_destroy() in qdisc_create_dflt()
qdisc_create_dflt() is missing to destroy the newly allocated default qdisc if the initialization fails resulting in leaks of all kinds. The only caller in mainline which may trigger this bug is sch_tbf.c in tbf_create_dflt_qdisc(). Note: qdisc_create_dflt() doesn't fulfill the official locking requirements of qdisc_destroy() but since the qdisc could never be seen by the outside world this doesn't matter and it can stay as-is until the locking of pkt_sched is cleaned up. Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d2287f8 commit 0fbbeb1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/sched/sch_generic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
438438
if (!ops->init || ops->init(sch, NULL) == 0)
439439
return sch;
440440

441+
qdisc_destroy(sch);
441442
errout:
442443
return NULL;
443444
}

0 commit comments

Comments
 (0)