Skip to content

[LTS 9.4] net: sched: use RCU read-side critical section in taprio_dump() #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions net/sched/sch_taprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,9 +2382,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
struct tc_mqprio_qopt opt = { 0 };
struct nlattr *nest, *sched_nest;

oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);

mqprio_qopt_reconstruct(dev, &opt);

nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
Expand All @@ -2405,30 +2402,39 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
nla_put_u32(skb, TCA_TAPRIO_ATTR_TXTIME_DELAY, q->txtime_delay))
goto options_error;

rcu_read_lock();

oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);

if (oper && taprio_dump_tc_entries(skb, q, oper))
goto options_error;
goto options_error_rcu;

if (oper && dump_schedule(skb, oper))
goto options_error;
goto options_error_rcu;

if (!admin)
goto done;

sched_nest = nla_nest_start_noflag(skb, TCA_TAPRIO_ATTR_ADMIN_SCHED);
if (!sched_nest)
goto options_error;
goto options_error_rcu;

if (dump_schedule(skb, admin))
goto admin_error;

nla_nest_end(skb, sched_nest);

done:
rcu_read_unlock();
return nla_nest_end(skb, nest);

admin_error:
nla_nest_cancel(skb, sched_nest);

options_error_rcu:
rcu_read_unlock();

options_error:
nla_nest_cancel(skb, nest);

Expand Down