mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
Merge pull request #32258 from yuwata/network-tc-fix-stack-overflow
network/tc: fix stack overflow
This commit is contained in:
commit
a4328b284e
@ -293,14 +293,20 @@ QDisc* qdisc_drop(QDisc *qdisc) {
|
|||||||
|
|
||||||
link = ASSERT_PTR(qdisc->link);
|
link = ASSERT_PTR(qdisc->link);
|
||||||
|
|
||||||
|
qdisc_mark(qdisc); /* To avoid stack overflow. */
|
||||||
|
|
||||||
/* also drop all child classes assigned to the qdisc. */
|
/* also drop all child classes assigned to the qdisc. */
|
||||||
SET_FOREACH(tclass, link->tclasses) {
|
SET_FOREACH(tclass, link->tclasses) {
|
||||||
|
if (tclass_is_marked(tclass))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (TC_H_MAJ(tclass->classid) != qdisc->handle)
|
if (TC_H_MAJ(tclass->classid) != qdisc->handle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tclass_drop(tclass);
|
tclass_drop(tclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qdisc_unmark(qdisc);
|
||||||
qdisc_enter_removed(qdisc);
|
qdisc_enter_removed(qdisc);
|
||||||
|
|
||||||
if (qdisc->state == 0) {
|
if (qdisc->state == 0) {
|
||||||
|
@ -260,14 +260,20 @@ TClass* tclass_drop(TClass *tclass) {
|
|||||||
|
|
||||||
link = ASSERT_PTR(tclass->link);
|
link = ASSERT_PTR(tclass->link);
|
||||||
|
|
||||||
|
tclass_mark(tclass); /* To avoid stack overflow. */
|
||||||
|
|
||||||
/* Also drop all child qdiscs assigned to the class. */
|
/* Also drop all child qdiscs assigned to the class. */
|
||||||
SET_FOREACH(qdisc, link->qdiscs) {
|
SET_FOREACH(qdisc, link->qdiscs) {
|
||||||
|
if (qdisc_is_marked(qdisc))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (qdisc->parent != tclass->classid)
|
if (qdisc->parent != tclass->classid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
qdisc_drop(qdisc);
|
qdisc_drop(qdisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tclass_unmark(tclass);
|
||||||
tclass_enter_removed(tclass);
|
tclass_enter_removed(tclass);
|
||||||
|
|
||||||
if (tclass->state == 0) {
|
if (tclass->state == 0) {
|
||||||
|
@ -4623,6 +4623,23 @@ class NetworkdTCTests(unittest.TestCase, Utilities):
|
|||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'qdisc teql1 31: root')
|
self.assertRegex(output, 'qdisc teql1 31: root')
|
||||||
|
|
||||||
|
@expectedFailureIfModuleIsNotAvailable('sch_fq', 'sch_sfq', 'sch_tbf')
|
||||||
|
def test_qdisc_drop(self):
|
||||||
|
copy_network_unit('12-dummy.netdev', '12-dummy.network')
|
||||||
|
start_networkd()
|
||||||
|
self.wait_online('dummy98:routable')
|
||||||
|
|
||||||
|
# Test case for issue #32247 and #32254.
|
||||||
|
for _ in range(20):
|
||||||
|
check_output('tc qdisc replace dev dummy98 root fq')
|
||||||
|
self.assertFalse(networkd_is_failed())
|
||||||
|
check_output('tc qdisc replace dev dummy98 root fq pacing')
|
||||||
|
self.assertFalse(networkd_is_failed())
|
||||||
|
check_output('tc qdisc replace dev dummy98 handle 10: root tbf rate 0.5mbit burst 5kb latency 70ms peakrate 1mbit minburst 1540')
|
||||||
|
self.assertFalse(networkd_is_failed())
|
||||||
|
check_output('tc qdisc add dev dummy98 parent 10:1 handle 100: sfq')
|
||||||
|
self.assertFalse(networkd_is_failed())
|
||||||
|
|
||||||
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user