[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aH19FKJmOfHHbdYo@xps>
Date: Sun, 20 Jul 2025 16:34:44 -0700
From: Xiang Mei <xmei5@....edu>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, will@...lsroot.io,
stephen@...workplumber.org
Subject: Re: [Patch v4 net 2/6] net_sched: Check the return value of
qfq_choose_next_agg()
On Sat, Jul 19, 2025 at 03:03:37PM -0700, Cong Wang 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")
> Cc: Xiang Mei <xmei5@....edu>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
> ---
> net/sched/sch_qfq.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> index f0eb70353744..f328a58c7b98 100644
> --- a/net/sched/sch_qfq.c
> +++ b/net/sched/sch_qfq.c
> @@ -1147,6 +1147,8 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
> * choose the new aggregate to serve.
> */
> in_serv_agg = q->in_serv_agg = qfq_choose_next_agg(q);
> + if (!in_serv_agg)
> + return NULL;
> skb = qfq_peek_skb(in_serv_agg, &cl, &len);
> }
> if (!skb)
> --
> 2.34.1
>
Reviewed-by: Xiang Mei <xmei5@....edu>
Thanks for the explanations and fix. The fix makes sense to me.
Powered by blists - more mailing lists