mirror of https://gitee.com/openkylin/linux.git
net_sched: add missing tcf_lock for act_connmark
According to the new locking rule, we have to take tcf_lock for both ->init() and ->dump(), as RTNL will be removed. However, it is missing for act_connmark. Cc: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
aa4e689ed1
commit
506a03aa04
|
@ -143,8 +143,10 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
/* replacing action and zone */
|
/* replacing action and zone */
|
||||||
|
spin_lock_bh(&ci->tcf_lock);
|
||||||
ci->tcf_action = parm->action;
|
ci->tcf_action = parm->action;
|
||||||
ci->zone = parm->zone;
|
ci->zone = parm->zone;
|
||||||
|
spin_unlock_bh(&ci->tcf_lock);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,16 +158,16 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a,
|
||||||
{
|
{
|
||||||
unsigned char *b = skb_tail_pointer(skb);
|
unsigned char *b = skb_tail_pointer(skb);
|
||||||
struct tcf_connmark_info *ci = to_connmark(a);
|
struct tcf_connmark_info *ci = to_connmark(a);
|
||||||
|
|
||||||
struct tc_connmark opt = {
|
struct tc_connmark opt = {
|
||||||
.index = ci->tcf_index,
|
.index = ci->tcf_index,
|
||||||
.refcnt = refcount_read(&ci->tcf_refcnt) - ref,
|
.refcnt = refcount_read(&ci->tcf_refcnt) - ref,
|
||||||
.bindcnt = atomic_read(&ci->tcf_bindcnt) - bind,
|
.bindcnt = atomic_read(&ci->tcf_bindcnt) - bind,
|
||||||
.action = ci->tcf_action,
|
|
||||||
.zone = ci->zone,
|
|
||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
|
spin_lock_bh(&ci->tcf_lock);
|
||||||
|
opt.action = ci->tcf_action;
|
||||||
|
opt.zone = ci->zone;
|
||||||
if (nla_put(skb, TCA_CONNMARK_PARMS, sizeof(opt), &opt))
|
if (nla_put(skb, TCA_CONNMARK_PARMS, sizeof(opt), &opt))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
|
@ -173,9 +175,12 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a,
|
||||||
if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t,
|
if (nla_put_64bit(skb, TCA_CONNMARK_TM, sizeof(t), &t,
|
||||||
TCA_CONNMARK_PAD))
|
TCA_CONNMARK_PAD))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
spin_unlock_bh(&ci->tcf_lock);
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
spin_unlock_bh(&ci->tcf_lock);
|
||||||
nlmsg_trim(skb, b);
|
nlmsg_trim(skb, b);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue