Skip to content

Commit 5f8196b

Browse files
edumazetNipaLocal
authored andcommitted
net_sched: add back BH safety to tcf_lock
Jamal reported that we had to use BH safety after all, because stats can be updated from BH handler. Fixes: 3133d5c ("net_sched: remove BH blocking in eight actions") Fixes: 53df77e ("net_sched: act_skbmod: use RCU in tcf_skbmod_dump()") Fixes: e97ae74 ("net_sched: act_tunnel_key: use RCU in tunnel_key_dump()") Fixes: 48b5e5d ("net_sched: act_vlan: use RCU in tcf_vlan_dump()") Reported-by: Jamal Hadi Salim <[email protected]> Closes: https://lore.kernel.org/netdev/CAM0EoMmhq66EtVqDEuNik8MVFZqkgxFbMu=fJtbNoYD7YXg4bA@mail.gmail.com/ Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent cce7070 commit 5f8196b

File tree

11 files changed

+22
-22
lines changed

11 files changed

+22
-22
lines changed

net/sched/act_connmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
169169

170170
nparms->action = parm->action;
171171

172-
spin_lock(&ci->tcf_lock);
172+
spin_lock_bh(&ci->tcf_lock);
173173
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
174174
oparms = rcu_replace_pointer(ci->parms, nparms, lockdep_is_held(&ci->tcf_lock));
175-
spin_unlock(&ci->tcf_lock);
175+
spin_unlock_bh(&ci->tcf_lock);
176176

177177
if (goto_ch)
178178
tcf_chain_put_by_act(goto_ch);

net/sched/act_csum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
101101
params_new->update_flags = parm->update_flags;
102102
params_new->action = parm->action;
103103

104-
spin_lock(&p->tcf_lock);
104+
spin_lock_bh(&p->tcf_lock);
105105
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
106106
params_new = rcu_replace_pointer(p->params, params_new,
107107
lockdep_is_held(&p->tcf_lock));
108-
spin_unlock(&p->tcf_lock);
108+
spin_unlock_bh(&p->tcf_lock);
109109

110110
if (goto_ch)
111111
tcf_chain_put_by_act(goto_ch);

net/sched/act_ct.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,11 +1410,11 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
14101410
goto cleanup;
14111411

14121412
params->action = parm->action;
1413-
spin_lock(&c->tcf_lock);
1413+
spin_lock_bh(&c->tcf_lock);
14141414
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
14151415
params = rcu_replace_pointer(c->params, params,
14161416
lockdep_is_held(&c->tcf_lock));
1417-
spin_unlock(&c->tcf_lock);
1417+
spin_unlock_bh(&c->tcf_lock);
14181418

14191419
if (goto_ch)
14201420
tcf_chain_put_by_act(goto_ch);

net/sched/act_ctinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
258258

259259
cp_new->action = actparm->action;
260260

261-
spin_lock(&ci->tcf_lock);
261+
spin_lock_bh(&ci->tcf_lock);
262262
goto_ch = tcf_action_set_ctrlact(*a, actparm->action, goto_ch);
263263
cp_new = rcu_replace_pointer(ci->params, cp_new,
264264
lockdep_is_held(&ci->tcf_lock));
265-
spin_unlock(&ci->tcf_lock);
265+
spin_unlock_bh(&ci->tcf_lock);
266266

267267
if (goto_ch)
268268
tcf_chain_put_by_act(goto_ch);

net/sched/act_mpls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ static int tcf_mpls_init(struct net *net, struct nlattr *nla,
296296
htons(ETH_P_MPLS_UC));
297297
p->action = parm->action;
298298

299-
spin_lock(&m->tcf_lock);
299+
spin_lock_bh(&m->tcf_lock);
300300
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
301301
p = rcu_replace_pointer(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
302-
spin_unlock(&m->tcf_lock);
302+
spin_unlock_bh(&m->tcf_lock);
303303

304304
if (goto_ch)
305305
tcf_chain_put_by_act(goto_ch);

net/sched/act_nat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
9595

9696
p = to_tcf_nat(*a);
9797

98-
spin_lock(&p->tcf_lock);
98+
spin_lock_bh(&p->tcf_lock);
9999
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
100100
oparm = rcu_replace_pointer(p->parms, nparm, lockdep_is_held(&p->tcf_lock));
101-
spin_unlock(&p->tcf_lock);
101+
spin_unlock_bh(&p->tcf_lock);
102102

103103
if (goto_ch)
104104
tcf_chain_put_by_act(goto_ch);

net/sched/act_pedit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
280280

281281
p = to_pedit(*a);
282282
nparms->action = parm->action;
283-
spin_lock(&p->tcf_lock);
283+
spin_lock_bh(&p->tcf_lock);
284284
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
285285
oparms = rcu_replace_pointer(p->parms, nparms, 1);
286-
spin_unlock(&p->tcf_lock);
286+
spin_unlock_bh(&p->tcf_lock);
287287

288288
if (oparms)
289289
call_rcu(&oparms->rcu, tcf_pedit_cleanup_rcu);

net/sched/act_skbedit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
261261
params_new->mask = *mask;
262262

263263
params_new->action = parm->action;
264-
spin_lock(&d->tcf_lock);
264+
spin_lock_bh(&d->tcf_lock);
265265
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
266266
params_new = rcu_replace_pointer(d->params, params_new,
267267
lockdep_is_held(&d->tcf_lock));
268-
spin_unlock(&d->tcf_lock);
268+
spin_unlock_bh(&d->tcf_lock);
269269
if (params_new)
270270
kfree_rcu(params_new, rcu);
271271
if (goto_ch)

net/sched/act_skbmod.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
194194
p->flags = lflags;
195195
p->action = parm->action;
196196
if (ovr)
197-
spin_lock(&d->tcf_lock);
197+
spin_lock_bh(&d->tcf_lock);
198198
/* Protected by tcf_lock if overwriting existing action. */
199199
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
200200
p_old = rcu_dereference_protected(d->skbmod_p, 1);
@@ -208,7 +208,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
208208

209209
rcu_assign_pointer(d->skbmod_p, p);
210210
if (ovr)
211-
spin_unlock(&d->tcf_lock);
211+
spin_unlock_bh(&d->tcf_lock);
212212

213213
if (p_old)
214214
kfree_rcu(p_old, rcu);

net/sched/act_tunnel_key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
531531
params_new->tcft_enc_metadata = metadata;
532532

533533
params_new->action = parm->action;
534-
spin_lock(&t->tcf_lock);
534+
spin_lock_bh(&t->tcf_lock);
535535
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
536536
params_new = rcu_replace_pointer(t->params, params_new,
537537
lockdep_is_held(&t->tcf_lock));
538-
spin_unlock(&t->tcf_lock);
538+
spin_unlock_bh(&t->tcf_lock);
539539
tunnel_key_release_params(params_new);
540540
if (goto_ch)
541541
tcf_chain_put_by_act(goto_ch);

0 commit comments

Comments
 (0)