Skip to content

Commit 90fabae

Browse files
tohojokuba-moo
authored andcommitted
sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb
When the GSO splitting feature of sch_cake is enabled, GSO superpackets will be broken up and the resulting segments enqueued in place of the original skb. In this case, CAKE calls consume_skb() on the original skb, but still returns NET_XMIT_SUCCESS. This can confuse parent qdiscs into assuming the original skb still exists, when it really has been freed. Fix this by adding the __NET_XMIT_STOLEN flag to the return value in this case. Fixes: 0c85034 ("sch_cake: Conditionally split GSO segments") Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Reported-by: [email protected] # ZDI-CAN-18231 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5a3a599 commit 90fabae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/sched/sch_cake.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
17131713
}
17141714
idx--;
17151715
flow = &b->flows[idx];
1716+
ret = NET_XMIT_SUCCESS;
17161717

17171718
/* ensure shaper state isn't stale */
17181719
if (!b->tin_backlog) {
@@ -1771,6 +1772,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
17711772

17721773
qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen);
17731774
consume_skb(skb);
1775+
ret |= __NET_XMIT_STOLEN;
17741776
} else {
17751777
/* not splitting */
17761778
cobalt_set_enqueue_time(skb, now);
@@ -1904,7 +1906,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
19041906
}
19051907
b->drop_overlimit += dropped;
19061908
}
1907-
return NET_XMIT_SUCCESS;
1909+
return ret;
19081910
}
19091911

19101912
static struct sk_buff *cake_dequeue_one(struct Qdisc *sch)

0 commit comments

Comments
 (0)