Skip to content

Commit c8cbe12

Browse files
vladimirolteankuba-moo
authored andcommitted
net/sched: taprio: taprio_offload_config_changed() is protected by rtnl_mutex
The locking in taprio_offload_config_changed() is wrong (but also inconsequentially so). The current_entry_lock does not serialize changes to the admin and oper schedules, only to the current entry. In fact, the rtnl_mutex does that, and that is taken at the time when taprio_change() is called. Replace the rcu_dereference_protected() method with the proper RCU annotation, and drop the unnecessary spin lock. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4d3c884 commit c8cbe12

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

net/sched/sch_taprio.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,16 +1193,10 @@ static void taprio_offload_config_changed(struct taprio_sched *q)
11931193
{
11941194
struct sched_gate_list *oper, *admin;
11951195

1196-
spin_lock(&q->current_entry_lock);
1197-
1198-
oper = rcu_dereference_protected(q->oper_sched,
1199-
lockdep_is_held(&q->current_entry_lock));
1200-
admin = rcu_dereference_protected(q->admin_sched,
1201-
lockdep_is_held(&q->current_entry_lock));
1196+
oper = rtnl_dereference(q->oper_sched);
1197+
admin = rtnl_dereference(q->admin_sched);
12021198

12031199
switch_schedules(q, &admin, &oper);
1204-
1205-
spin_unlock(&q->current_entry_lock);
12061200
}
12071201

12081202
static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)

0 commit comments

Comments
 (0)