1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

Merge branch 'net_sched-two-security-bug-fixes-and-test-cases'

Cong Wang says:

====================
net_sched: two security bug fixes and test cases

This patchset contains two bug fixes reported in security mailing list,
and test cases for both of them.
====================

Link: https://patch.msgid.link/20250204005841.223511-1-xiyou.wangcong@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2025-02-05 18:15:00 -08:00
commit 02b71dc115
4 changed files with 60 additions and 2 deletions

View file

@ -40,6 +40,9 @@ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch,
{
unsigned int prev_backlog;
if (unlikely(READ_ONCE(sch->limit) == 0))
return qdisc_drop(skb, sch, to_free);
if (likely(sch->q.qlen < READ_ONCE(sch->limit)))
return qdisc_enqueue_tail(skb, sch);

View file

@ -749,9 +749,9 @@ deliver:
if (err != NET_XMIT_SUCCESS) {
if (net_xmit_drop_count(err))
qdisc_qstats_drop(sch);
qdisc_tree_reduce_backlog(sch, 1, pkt_len);
sch->qstats.backlog -= pkt_len;
sch->q.qlen--;
qdisc_tree_reduce_backlog(sch, 1, pkt_len);
}
goto tfifo_dequeue;
}

View file

@ -94,5 +94,37 @@
"$TC qdisc del dev $DUMMY ingress",
"$IP addr del 10.10.10.10/24 dev $DUMMY"
]
}
},
{
"id": "a4b9",
"name": "Test class qlen notification",
"category": [
"qdisc"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$IP link set dev $DUMMY up || true",
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY root handle 1: drr",
"$TC filter add dev $DUMMY parent 1: basic classid 1:1",
"$TC class add dev $DUMMY parent 1: classid 1:1 drr",
"$TC qdisc add dev $DUMMY parent 1:1 handle 2: netem",
"$TC qdisc add dev $DUMMY parent 2: handle 3: drr",
"$TC filter add dev $DUMMY parent 3: basic action drop",
"$TC class add dev $DUMMY parent 3: classid 3:1 drr",
"$TC class del dev $DUMMY classid 1:1",
"$TC class add dev $DUMMY parent 1: classid 1:1 drr"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC qdisc ls dev $DUMMY",
"matchPattern": "drr 1: root",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DUMMY root handle 1: drr",
"$IP addr del 10.10.10.10/24 dev $DUMMY"
]
}
]

View file

@ -313,6 +313,29 @@
"matchPattern": "qdisc bfifo 1: root",
"matchCount": "0",
"teardown": [
]
},
{
"id": "d774",
"name": "Check pfifo_head_drop qdisc enqueue behaviour when limit == 0",
"category": [
"qdisc",
"pfifo_head_drop"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY root handle 1: pfifo_head_drop limit 0",
"$IP link set dev $DUMMY up || true"
],
"cmdUnderTest": "ping -c2 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -s qdisc show dev $DUMMY",
"matchPattern": "dropped 2",
"matchCount": "1",
"teardown": [
]
}
]