Skip to content

Commit 1c75609

Browse files
committed
Merge branch 'ets-use-old-nbands-while-purging-unused-classes'
Davide Caratti says: ==================== ets: use old 'nbands' while purging unused classes - patch 1/2 fixes a NULL dereference in the control path of sch_ets qdisc - patch 2/2 extends kselftests to verify effectiveness of the above fix ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 2121227 + 774a2ae commit 1c75609

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

net/sched/sch_ets.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,18 +651,19 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
651651

652652
sch_tree_lock(sch);
653653

654+
for (i = nbands; i < oldbands; i++) {
655+
if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
656+
list_del_init(&q->classes[i].alist);
657+
qdisc_purge_queue(q->classes[i].qdisc);
658+
}
659+
654660
WRITE_ONCE(q->nbands, nbands);
655661
for (i = nstrict; i < q->nstrict; i++) {
656662
if (q->classes[i].qdisc->q.qlen) {
657663
list_add_tail(&q->classes[i].alist, &q->active);
658664
q->classes[i].deficit = quanta[i];
659665
}
660666
}
661-
for (i = q->nbands; i < oldbands; i++) {
662-
if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
663-
list_del_init(&q->classes[i].alist);
664-
qdisc_purge_queue(q->classes[i].qdisc);
665-
}
666667
WRITE_ONCE(q->nstrict, nstrict);
667668
memcpy(q->prio2band, priomap, sizeof(priomap));
668669

tools/testing/selftests/net/forwarding/sch_ets.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ALL_TESTS="
1111
ets_test_strict
1212
ets_test_mixed
1313
ets_test_dwrr
14+
ets_test_plug
1415
classifier_mode
1516
ets_test_strict
1617
ets_test_mixed

tools/testing/selftests/net/forwarding/sch_ets_tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,11 @@ ets_test_dwrr()
224224
ets_set_dwrr_two_bands
225225
xfail_on_slow ets_dwrr_test_01
226226
}
227+
228+
ets_test_plug()
229+
{
230+
ets_change_qdisc $put 2 "3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3" "1514 1514"
231+
tc qdisc add dev $put handle 20: parent 10:4 plug
232+
start_traffic_pktsize 100 $h1.10 192.0.2.1 192.0.2.2 00:c1:a0:c1:a0:00 "-c 1"
233+
ets_qdisc_setup $put 2
234+
}

0 commit comments

Comments
 (0)