Subject: Re: [Patch net v6 1/8] net_sched: Check the return value of qfq_choose_next_agg()

From: Stephen Hemminger <[email-masked]>
Date: Tue, 30 Dec 2025 09:24:15 -0800

On Sat, 27 Dec 2025 11:41:28 -0800
Cong Wang <[email-masked]> wrote:

> qfq_choose_next_agg() could return NULL so its return value should be
> properly checked unless NULL is acceptable.
> 
> There are two cases we need to deal with:
> 
> 1) q->in_serv_agg, which is okay with NULL since it is either checked or
>    just compared with other pointer without dereferencing. In fact, it
>    is even intentionally set to NULL in one of the cases.
> 
> 2) in_serv_agg, which is a temporary local variable, which is not okay
>    with NULL, since it is dereferenced immediately, hence must be checked.
> 
> This fix corrects one of the 2nd cases, and leaving the 1st case as they are.
> 
> Although this bug is triggered with the netem duplicate change, the root
> cause is still within qfq qdisc.
> 
> Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
> Reviewed-by: Xiang Mei <[email-masked]>
> Signed-off-by: Cong Wang <[email-masked]>

Looks correct, if you make a new version might want to add a comment.
If you really want to get picky the rest of the code in QFQ compares
with NULL. i.e (in_serv_agg != NULL)

Acked-by: Stephen Hemminger <[email-masked]>