Skip to content

Commit 3879cff

Browse files
edumazetkuba-moo
authored andcommitted
net/sched: sch_qfq: do not free existing class in qfq_change_class()
Fixes qfq_change_class() error case. cl->qdisc and cl should only be freed if a new class and qdisc were allocated, or we risk various UAF. Fixes: 462dbc9 ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost") Reported-by: syzbot+07f3f38f723c335f106d@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/6965351d.050a0220.eaf7.00c5.GAE@google.com/T/#u Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/20260112175656.17605-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dbe6b31 commit 3879cff

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

net/sched/sch_qfq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,10 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
529529
return 0;
530530

531531
destroy_class:
532-
qdisc_put(cl->qdisc);
533-
kfree(cl);
532+
if (!existing) {
533+
qdisc_put(cl->qdisc);
534+
kfree(cl);
535+
}
534536
return err;
535537
}
536538

0 commit comments

Comments
 (0)