summaryrefslogtreecommitdiffstats
path: root/net/sched/cls_api.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-05-20 15:01:31 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-23 11:00:06 -0400
commit31efcc250a1dea96edca6595a9639d898cf99ae5 (patch)
treea01dfd6bacdf9d2c395bbd1f7dfc63c191ede3d2 /net/sched/cls_api.c
parent218b6a5b23e939caf2064549b1cb61ba22b9d0a1 (diff)
downloadlinux-31efcc250a1dea96edca6595a9639d898cf99ae5.tar.gz
linux-31efcc250a1dea96edca6595a9639d898cf99ae5.tar.bz2
linux-31efcc250a1dea96edca6595a9639d898cf99ae5.zip
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: 2190d1d0944f ("net: sched: introduce helpers to work with filter chains") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r--net/sched/cls_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 4020b8d932a1..85088ed07f6a 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -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);
}