[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220610070529.1623-1-zhudi2@huawei.com>
Date: Fri, 10 Jun 2022 15:05:29 +0800
From: Di Zhu <zhudi2@...wei.com>
To: <jhs@...atatu.com>, <xiyou.wangcong@...il.com>, <jiri@...nulli.us>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<zhudi2@...wei.com>, <rose.chen@...wei.com>,
<syzbot+7a12909485b94426aceb@...kaller.appspotmail.com>
Subject: [PATCH] fq_codel: Discard problematic packets with pkt_len 0
Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
skbs, that is, the flow->head is null.
The root cause is that: when the first queued skb with pkt_len 0, backlogs
of the flow that this skb enqueued is still 0 and if sch->limit is set to
0 then fq_codel_drop() will be called. At this point, the backlogs of all
flows are all 0, so flow with idx 0 is selected to drop, but this flow have
not any skbs.
skb with pkt_len 0 can break existing processing logic, so just discard
these invalid skbs.
LINK: [1] https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16ec96c5
Reported-by: syzbot+7a12909485b94426aceb@...kaller.appspotmail.com
Signed-off-by: Di Zhu <zhudi2@...wei.com>
---
net/sched/sch_fq_codel.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 839e1235db05..c0f82b7358e1 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,
unsigned int pkt_len;
bool memory_limited;
+ if (unlikely(!qdisc_pkt_len(skb)))
+ return qdisc_drop(skb, sch, to_free);
+
idx = fq_codel_classify(skb, sch, &ret);
if (idx == 0) {
if (ret & __NET_XMIT_BYPASS)
--
2.27.0
Powered by blists - more mailing lists