Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fbbeb1b authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller
Browse files

[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: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2287f84
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -438,6 +438,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
	if (!ops->init || ops->init(sch, NULL) == 0)
	if (!ops->init || ops->init(sch, NULL) == 0)
		return sch;
		return sch;


	qdisc_destroy(sch);
errout:
errout:
	return NULL;
	return NULL;
}
}