summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@toke.dk>2022-09-05 21:21:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-15 12:17:06 +0200
commit5dac9b60b48ce8a3cd498c5680e8b5f0f4034461 (patch)
tree472e13631b9f6653089d36053c490c4ab7bec1ac
parent4d941fdf910bd6da3a017627ef9c08e9f3f17c06 (diff)
downloadlinux-stable-5dac9b60b48ce8a3cd498c5680e8b5f0f4034461.tar.gz
linux-stable-5dac9b60b48ce8a3cd498c5680e8b5f0f4034461.tar.bz2
linux-stable-5dac9b60b48ce8a3cd498c5680e8b5f0f4034461.zip
sch_sfb: Also store skb len before calling child enqueue
[ Upstream commit 2f09707d0c972120bf794cfe0f0c67e2c2ddb252 ] Cong Wang noticed that the previous fix for sch_sfb accessing the queued skb after enqueueing it to a child qdisc was incomplete: the SFB enqueue function was also calling qdisc_qstats_backlog_inc() after enqueue, which reads the pkt len from the skb cb field. Fix this by also storing the skb len, and using the stored value to increment the backlog after enqueueing. Fixes: 9efd23297cca ("sch_sfb: Don't assume the skb is still around after enqueueing to child") Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> Acked-by: Cong Wang <cong.wang@bytedance.com> Link: https://lore.kernel.org/r/20220905192137.965549-1-toke@toke.dk Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/sched/sch_sfb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 38cf06515695..a8ef8efa62fc 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -285,6 +285,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
{
struct sfb_sched_data *q = qdisc_priv(sch);
+ unsigned int len = qdisc_pkt_len(skb);
struct Qdisc *child = q->qdisc;
struct tcf_proto *fl;
struct sfb_skb_cb cb;
@@ -407,7 +408,7 @@ enqueue:
memcpy(&cb, sfb_skb_cb(skb), sizeof(cb));
ret = qdisc_enqueue(skb, child, to_free);
if (likely(ret == NET_XMIT_SUCCESS)) {
- qdisc_qstats_backlog_inc(sch, skb);
+ sch->qstats.backlog += len;
sch->q.qlen++;
increment_qlen(&cb, q);
} else if (net_xmit_drop_count(ret)) {