[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231109115527.loaz76xp5wxwbqav@skbuf>
Date: Thu, 9 Nov 2023 13:55:27 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: Faizal Rahim <faizal.abdul.rahim@...ux.intel.com>
Cc: Vinicius Costa Gomes <vinicius.gomes@...el.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net 6/7] net/sched: taprio: fix q->current_entry is
NULL before its expiry
On Tue, Nov 07, 2023 at 06:20:22AM -0500, Faizal Rahim wrote:
> Fix the issue of prematurely setting q->current_entry to NULL in the
> setup_first_end_time() function when a new admin schedule arrives
> while the oper schedule is still running but hasn't transitioned yet.
> This premature setting causes problems because any reference to
> q->current_entry, such as in taprio_dequeue(), will result in NULL
> during this period, which is incorrect. q->current_entry should remain
> valid until the currently running entry expires.
>
> To address this issue, only set q->current_entry to NULL when there is
> no oper schedule currently running.
>
> Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler")
The "Fixes" tag represents the commit where the code started becoming a
problem, not when the code that you're changing was first introduced.
I find it hard to believe that the problem was in commit 5a781ccbd19e
("tc: Add support for configuring the taprio scheduler"), because we
didn't support admin -> oper dynamic schedules back then.
> Signed-off-by: Faizal Rahim <faizal.abdul.rahim@...ux.intel.com>
> ---
> net/sched/sch_taprio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> index 01b114edec30..c60e9e7ac193 100644
> --- a/net/sched/sch_taprio.c
> +++ b/net/sched/sch_taprio.c
> @@ -1375,7 +1375,8 @@ static void setup_first_end_time(struct taprio_sched *q,
> first->gate_close_time[tc] = ktime_add_ns(base, first->gate_duration[tc]);
> }
>
> - rcu_assign_pointer(q->current_entry, NULL);
> + if (!hrtimer_active(&q->advance_timer))
> + rcu_assign_pointer(q->current_entry, NULL);
> }
>
> static void taprio_start_sched(struct Qdisc *sch,
> --
> 2.25.1
>
Powered by blists - more mailing lists