fq_codel: Discard problematic packets with pkt_len 0
Subsystems (3)
PATCH 1/1 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.
--- net/sched/sch_fq_codel.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/sch_fq_codel.c +3 -0
@@ -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)
Signature · 1 line
2.27.0
Quoted 24 lines · Di Zhu
Syzbot found an issue [1]:
fq_codel_drop()try to drop a flow whitout any skbs, that is, theflow->headis null.
The root cause is that: when the first queued skb withpkt_len0, backlogs of the flow that this skb enqueued is still 0 and ifsch->limitis set to 0 thenfq_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 withpkt_len0 can break existing processing logic, so just discard these invalid skbs.Reported-by [email protected]Signed-off-by Di Zhu <[email protected]>--- net/sched/sch_fq_codel.c | 3 +++ 1 file changed, 3 insertions(+)net/sched/sch_fq_codel.c +0
-0
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 196
Quoted 6 lines
net/sched/sch_fq_codel.c +3
-0@@ -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); +
This has been discussed in the past.
Feeding ndo_start_xmit() in hundreds of drivers with zero-length packets will crash anyway.
We are not going to add such silly tests in all qdiscs, and then all ndo_start_xmit(), since qdiscs are not mandatory.
Please instead fix BPF layer, instead of hundreds of drivers/qdiscs.
Quoted 29 lines · Eric Dumazet
Quoted 27 lines · Di Zhu
Syzbot found an issue [1]:
fq_codel_drop()try to drop a flow whitout any skbs, that is, theflow->headis null.
The root cause is that: when the first queued skb withpkt_len0, backlogs of the flow that this skb enqueued is still 0 and ifsch->limitis set to 0 thenfq_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 withpkt_len0 can break existing processing logic, so just discard these invalid skbs.Reported-by [email protected]Signed-off-by Di Zhu <[email protected]>--- net/sched/sch_fq_codel.c | 3 +++ 1 file changed, 3 insertions(+)net/sched/sch_fq_codel.c +0
-0@@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,unsigned int pkt_len;bool memory_limited;
Quoted 7 lines
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 196
Quoted 3 lines
net/sched/sch_fq_codel.c +3
-0+if (unlikely (!qdisc_pkt_len (skb))) +return qdisc_drop (skb, sch, to_free); +This has been discussed in the past.
https://www.spinics.net/lists/netdev/msg777503.html
Quoted 7 lines
Feeding
ndo_start_xmit()in hundreds of drivers with zero-length packets will crash anyway.We are not going to add such silly tests in all qdiscs, and then all
ndo_start_xmit(), since qdiscs are not mandatory.Please instead fix BPF layer, instead of hundreds of
drivers/qdiscs.
Thanks Eric, I'll take a look.
Quoted 50 lines · Eric Dumazet
Quoted 13 lines · Di Zhu
Quoted 11 lines
Syzbot found an issue [1]:
fq_codel_drop()try to drop a flow whitout any skbs, that is, theflow->headis null.
The root cause is that: when the first queued skb withpkt_len0, backlogs of the flow that this skb enqueued is still 0 and ifsch->limitis set to 0 thenfq_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 withpkt_len0 can break existing processing logic, so just discard these invalid skbs.Quoted 1 line
Quoted 1 line
LINK [1]https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16e
c96c5Quoted 7 lines
Quoted 7 lines
Reported-by [email protected]Signed-off-by Di Zhu <[email protected]>--- net/sched/sch_fq_codel.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 5 lines
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb,
Quoted 5 lines
net/sched/sch_fq_codel.c +0
-0@@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb,struct Qdisc *sch,
Quoted 10 lines
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 196
Quoted 6 lines
net/sched/sch_fq_codel.c +3
-0unsigned int pkt_len;bool memory_limited; +if (unlikely (!qdisc_pkt_len (skb))) +return qdisc_drop (skb, sch, to_free); +This has been discussed in the past.
https://www.spinics.net/lists/netdev/msg777503.html
Quoted 7 lines
Feeding
ndo_start_xmit()in hundreds of drivers with zero-length packets will crash anyway.We are not going to add such silly tests in all qdiscs, and then all
ndo_start_xmit(), since qdiscs are not mandatory.Please instead fix BPF layer, instead of hundreds of
drivers/qdiscs.