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

Commit 787e0617 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE



Fix incorrect use of RB_EMPTY_NODE in htb_safe_rb_erase, which makes it
skip nodes within the rbtree instead of nodes not in the tree, resulting
in crashes later on.

The root cause for this seems to be the very counter-intuitive behaviour
of the RB_EMPTY_NODE macro, which returns _false_ when the node is empty.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 321efff7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(struct htb_sched *q,
/* If this triggers, it is a bug in this code, but it need not be fatal */
/* If this triggers, it is a bug in this code, but it need not be fatal */
static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
{
{
	if (RB_EMPTY_NODE(rb)) {
	if (!RB_EMPTY_NODE(rb)) {
		WARN_ON(1);
		WARN_ON(1);
	} else {
	} else {
		rb_erase(rb, root);
		rb_erase(rb, root);