net/sched: sch_qfq: do not free existing class in qfq_change_class()
Subsystems (3)
PATCH 1/1 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.
--- net/sched/sch_qfq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sched/sch_qfq.c +4 -2
@@ -529,8 +529,10 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,return 0 ; destroy_class: -qdisc_put (cl->qdisc); -kfree (cl); +if (!existing) { +qdisc_put (cl->qdisc); +kfree (cl); + }return err; }
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Quoted 10 lines · Eric Dumazet
Fixes
qfq_change_class()error case.
cl->qdiscand cl should only be freed if a new class and qdisc were allocated, or we risk various UAF.Fixes 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>
Eric,
The patch looks correct. Initially i was scratching my head trying to see how you knew it was the same issue. I gues on a UAF even without a repro syzbot can tell you exactly where the UAF happened?
cheers,
jamal
Quoted 23 lines
net/sched/sch_qfq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)net/sched/sch_qfq.c +4
-3@@ -529,8 +529,10 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,return 0 ; destroy_class: -qdisc_put (cl->qdisc); -kfree (cl); +if (!existing) { +qdisc_put (cl->qdisc); +kfree (cl); + }return err; } --2.52.0.457.g6b5491de43-goog
Quoted 13 lines · Jamal Hadi Salim
Quoted 10 lines · Eric Dumazet
Fixes
qfq_change_class()error case.
cl->qdiscand cl should only be freed if a new class and qdisc were allocated, or we risk various UAF.Fixes 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>
Quoted 4 lines
Eric,
The patch looks correct. Initially i was scratching my head trying to see how you knew it was the same issue. I gues on a UAF even without a repro syzbot can tell you exactly where the UAF happened?
Without a repro, I was still able to root-cause the issue to the unexpected kfree().
syzbot report was sent as-is on the mailing list, I had no more information.
Thanks.
Quoted 29 lines
Reviewed-by Jamal Hadi Salim <[email protected]>cheers,
jamalQuoted 23 lines
net/sched/sch_qfq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)net/sched/sch_qfq.c +4
-3@@ -529,8 +529,10 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,return 0 ; destroy_class: -qdisc_put (cl->qdisc); -kfree (cl); +if (!existing) { +qdisc_put (cl->qdisc); +kfree (cl); + }return err; } --2.52.0.457.g6b5491de43-goog
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Mon, 12 Jan 2026 17:56:56 +0000 you wrote:
Fixes
qfq_change_class()error case.
cl->qdiscand cl should only be freed if a new class and qdisc were allocated, or we risk various UAF.Fixes 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>[...]
Here is the summary with links:
- [net] net/sched: sch_qfq: do not free existing class in qfq_change_class()
https://git.kernel.org/netdev/net/c/3879cffd9d07
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html