mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-11 17:10:13 +00:00
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: 3133d5c15cb5 ("net_sched: remove BH blocking in eight actions")
Fixes: 53df77e78590 ("net_sched: act_skbmod: use RCU in tcf_skbmod_dump()")
Fixes: e97ae742972f ("net_sched: act_tunnel_key: use RCU in tunnel_key_dump()")
Fixes: 48b5e5dbdb23 ("net_sched: act_vlan: use RCU in tcf_vlan_dump()")
Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
Closes: https://lore.kernel.org/netdev/CAM0EoMmhq66EtVqDEuNik8MVFZqkgxFbMu=fJtbNoYD7YXg4bA@mail.gmail.com/
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20250901092608.2032473-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
23313771c7
commit
3016024d75
@ -169,10 +169,10 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
|
||||
|
||||
nparms->action = parm->action;
|
||||
|
||||
spin_lock(&ci->tcf_lock);
|
||||
spin_lock_bh(&ci->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
oparms = rcu_replace_pointer(ci->parms, nparms, lockdep_is_held(&ci->tcf_lock));
|
||||
spin_unlock(&ci->tcf_lock);
|
||||
spin_unlock_bh(&ci->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -101,11 +101,11 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
|
||||
params_new->update_flags = parm->update_flags;
|
||||
params_new->action = parm->action;
|
||||
|
||||
spin_lock(&p->tcf_lock);
|
||||
spin_lock_bh(&p->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
params_new = rcu_replace_pointer(p->params, params_new,
|
||||
lockdep_is_held(&p->tcf_lock));
|
||||
spin_unlock(&p->tcf_lock);
|
||||
spin_unlock_bh(&p->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -1410,11 +1410,11 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
|
||||
goto cleanup;
|
||||
|
||||
params->action = parm->action;
|
||||
spin_lock(&c->tcf_lock);
|
||||
spin_lock_bh(&c->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
params = rcu_replace_pointer(c->params, params,
|
||||
lockdep_is_held(&c->tcf_lock));
|
||||
spin_unlock(&c->tcf_lock);
|
||||
spin_unlock_bh(&c->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -258,11 +258,11 @@ static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
|
||||
|
||||
cp_new->action = actparm->action;
|
||||
|
||||
spin_lock(&ci->tcf_lock);
|
||||
spin_lock_bh(&ci->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, actparm->action, goto_ch);
|
||||
cp_new = rcu_replace_pointer(ci->params, cp_new,
|
||||
lockdep_is_held(&ci->tcf_lock));
|
||||
spin_unlock(&ci->tcf_lock);
|
||||
spin_unlock_bh(&ci->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -296,10 +296,10 @@ static int tcf_mpls_init(struct net *net, struct nlattr *nla,
|
||||
htons(ETH_P_MPLS_UC));
|
||||
p->action = parm->action;
|
||||
|
||||
spin_lock(&m->tcf_lock);
|
||||
spin_lock_bh(&m->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
p = rcu_replace_pointer(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
|
||||
spin_unlock(&m->tcf_lock);
|
||||
spin_unlock_bh(&m->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -95,10 +95,10 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
|
||||
|
||||
p = to_tcf_nat(*a);
|
||||
|
||||
spin_lock(&p->tcf_lock);
|
||||
spin_lock_bh(&p->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
oparm = rcu_replace_pointer(p->parms, nparm, lockdep_is_held(&p->tcf_lock));
|
||||
spin_unlock(&p->tcf_lock);
|
||||
spin_unlock_bh(&p->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -280,10 +280,10 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
|
||||
|
||||
p = to_pedit(*a);
|
||||
nparms->action = parm->action;
|
||||
spin_lock(&p->tcf_lock);
|
||||
spin_lock_bh(&p->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
oparms = rcu_replace_pointer(p->parms, nparms, 1);
|
||||
spin_unlock(&p->tcf_lock);
|
||||
spin_unlock_bh(&p->tcf_lock);
|
||||
|
||||
if (oparms)
|
||||
call_rcu(&oparms->rcu, tcf_pedit_cleanup_rcu);
|
||||
|
||||
@ -261,11 +261,11 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
|
||||
params_new->mask = *mask;
|
||||
|
||||
params_new->action = parm->action;
|
||||
spin_lock(&d->tcf_lock);
|
||||
spin_lock_bh(&d->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
params_new = rcu_replace_pointer(d->params, params_new,
|
||||
lockdep_is_held(&d->tcf_lock));
|
||||
spin_unlock(&d->tcf_lock);
|
||||
spin_unlock_bh(&d->tcf_lock);
|
||||
if (params_new)
|
||||
kfree_rcu(params_new, rcu);
|
||||
if (goto_ch)
|
||||
|
||||
@ -194,7 +194,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
|
||||
p->flags = lflags;
|
||||
p->action = parm->action;
|
||||
if (ovr)
|
||||
spin_lock(&d->tcf_lock);
|
||||
spin_lock_bh(&d->tcf_lock);
|
||||
/* Protected by tcf_lock if overwriting existing action. */
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
p_old = rcu_dereference_protected(d->skbmod_p, 1);
|
||||
@ -208,7 +208,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
|
||||
|
||||
rcu_assign_pointer(d->skbmod_p, p);
|
||||
if (ovr)
|
||||
spin_unlock(&d->tcf_lock);
|
||||
spin_unlock_bh(&d->tcf_lock);
|
||||
|
||||
if (p_old)
|
||||
kfree_rcu(p_old, rcu);
|
||||
|
||||
@ -531,11 +531,11 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
|
||||
params_new->tcft_enc_metadata = metadata;
|
||||
|
||||
params_new->action = parm->action;
|
||||
spin_lock(&t->tcf_lock);
|
||||
spin_lock_bh(&t->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
params_new = rcu_replace_pointer(t->params, params_new,
|
||||
lockdep_is_held(&t->tcf_lock));
|
||||
spin_unlock(&t->tcf_lock);
|
||||
spin_unlock_bh(&t->tcf_lock);
|
||||
tunnel_key_release_params(params_new);
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
@ -253,10 +253,10 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
|
||||
}
|
||||
|
||||
p->action = parm->action;
|
||||
spin_lock(&v->tcf_lock);
|
||||
spin_lock_bh(&v->tcf_lock);
|
||||
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
|
||||
p = rcu_replace_pointer(v->vlan_p, p, lockdep_is_held(&v->tcf_lock));
|
||||
spin_unlock(&v->tcf_lock);
|
||||
spin_unlock_bh(&v->tcf_lock);
|
||||
|
||||
if (goto_ch)
|
||||
tcf_chain_put_by_act(goto_ch);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user