提交 31efcc25 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net/sched: properly assign RCU pointer in tcf_chain_tp_insert/remove

*p_filter_chain is rcu-dereferenced on reader path. So here in writer,
property assign the pointer.

Fixes: 2190d1d0 ("net: sched: introduce helpers to work with filter chains")
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 218b6a5b
......@@ -351,7 +351,7 @@ static void tcf_chain_tp_insert(struct tcf_chain *chain,
{
if (chain->p_filter_chain &&
*chain_info->pprev == chain->filter_chain)
*chain->p_filter_chain = tp;
rcu_assign_pointer(*chain->p_filter_chain, tp);
RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain_info));
rcu_assign_pointer(*chain_info->pprev, tp);
}
......@@ -363,7 +363,7 @@ static void tcf_chain_tp_remove(struct tcf_chain *chain,
struct tcf_proto *next = rtnl_dereference(chain_info->next);
if (chain->p_filter_chain && tp == chain->filter_chain)
*chain->p_filter_chain = next;
RCU_INIT_POINTER(*chain->p_filter_chain, next);
RCU_INIT_POINTER(*chain_info->pprev, next);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册