Skip to content

Commit a969a63

Browse files
dcarattigregkh
authored andcommitted
net/sched: sch_taprio: reset child qdiscs before freeing them
[ Upstream commit 44d4775 ] syzkaller shows that packets can still be dequeued while taprio_destroy() is running. Let sch_taprio use the reset() function to cancel the advance timer and drop all skbs from the child qdiscs. Fixes: 5a781cc ("tc: Add support for configuring the taprio scheduler") Link: https://syzkaller.appspot.com/bug?id=f362872379bf8f0017fb667c1ab158f2d1e764ae Reported-by: [email protected] Signed-off-by: Davide Caratti <[email protected]> Acked-by: Vinicius Costa Gomes <[email protected]> Link: https://lore.kernel.org/r/63b6d79b0e830ebb0283e020db4df3cdfdfb2b94.1608142843.git.dcaratti@redhat.com Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b1313fe commit a969a63

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

net/sched/sch_taprio.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,21 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
15961596
return err;
15971597
}
15981598

1599+
static void taprio_reset(struct Qdisc *sch)
1600+
{
1601+
struct taprio_sched *q = qdisc_priv(sch);
1602+
struct net_device *dev = qdisc_dev(sch);
1603+
int i;
1604+
1605+
hrtimer_cancel(&q->advance_timer);
1606+
if (q->qdiscs) {
1607+
for (i = 0; i < dev->num_tx_queues && q->qdiscs[i]; i++)
1608+
qdisc_reset(q->qdiscs[i]);
1609+
}
1610+
sch->qstats.backlog = 0;
1611+
sch->q.qlen = 0;
1612+
}
1613+
15991614
static void taprio_destroy(struct Qdisc *sch)
16001615
{
16011616
struct taprio_sched *q = qdisc_priv(sch);
@@ -1606,7 +1621,6 @@ static void taprio_destroy(struct Qdisc *sch)
16061621
list_del(&q->taprio_list);
16071622
spin_unlock(&taprio_list_lock);
16081623

1609-
hrtimer_cancel(&q->advance_timer);
16101624

16111625
taprio_disable_offload(dev, q, NULL);
16121626

@@ -1953,6 +1967,7 @@ static struct Qdisc_ops taprio_qdisc_ops __read_mostly = {
19531967
.init = taprio_init,
19541968
.change = taprio_change,
19551969
.destroy = taprio_destroy,
1970+
.reset = taprio_reset,
19561971
.peek = taprio_peek,
19571972
.dequeue = taprio_dequeue,
19581973
.enqueue = taprio_enqueue,

0 commit comments

Comments
 (0)