]> git.ipfire.org Git - thirdparty/systemd.git/commit
network/tc: Avoid concurrent set modification in tclass_drop()/qdisc_drop() 32611/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 1 May 2024 12:41:41 +0000 (14:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 1 May 2024 14:15:20 +0000 (16:15 +0200)
commitee8f605ded4fea6b93aae018415efae877c26ed2
tree6afd213b50fcfa60986097d1a1e417063b56dbd9
parentf2adc1de8963030d4c9965e79572ac8db68a553c
network/tc: Avoid concurrent set modification in tclass_drop()/qdisc_drop()

With the current algorithm, we can end up removing entries from the
qdisc/tclass sets while having multiple open iterators over the sets at
various positions which leads to assertion failures in the hashmap logic
as it's only safe to remove the "current" entry.

To avoid the problem, let's split up marking and dropping of tclasses
and qdiscs. First, we recursively iterate tclasses/qdiscs and mark all
that need to be removed. Next, we iterate once over tclasses and qdiscs
and remove all marked entries.

Fixes 632d321050f58fe1b5bed7cfe769d212377c0301
src/network/tc/qdisc.c
src/network/tc/qdisc.h
src/network/tc/tclass.c
src/network/tc/tclass.h