All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next 1/2] net/sched: properly assign RCU pointer in tcf_chain_tp_insert/remove
@ 2017-05-20 13:01 Jiri Pirko
  2017-05-20 13:01 ` [patch net-next 2/2] net/sched: fix filter flushing Jiri Pirko
  2017-05-23 15:00 ` [patch net-next 1/2] net/sched: properly assign RCU pointer in tcf_chain_tp_insert/remove David Miller
  0 siblings, 2 replies; 15+ messages in thread
From: Jiri Pirko @ 2017-05-20 13:01 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, xiyou.wangcong, edumazet, daniel, simon.horman,
	mlxsw, colin.king

From: Jiri Pirko <jiri@mellanox.com>

*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>
---
 net/sched/cls_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 4020b8d..85088ed 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);
 }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-05-23 15:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-20 13:01 [patch net-next 1/2] net/sched: properly assign RCU pointer in tcf_chain_tp_insert/remove Jiri Pirko
2017-05-20 13:01 ` [patch net-next 2/2] net/sched: fix filter flushing Jiri Pirko
2017-05-21  0:16   ` Cong Wang
2017-05-21  5:54     ` Jiri Pirko
2017-05-21 18:27       ` Cong Wang
2017-05-21 19:19         ` Jiri Pirko
2017-05-22 10:42           ` Jamal Hadi Salim
2017-05-22 12:36             ` Jiri Pirko
2017-05-22 20:54           ` Cong Wang
2017-05-22 21:04             ` Cong Wang
2017-05-23  5:17               ` Jiri Pirko
2017-05-23  5:39                 ` Cong Wang
2017-05-23  5:40   ` Cong Wang
2017-05-23 15:00   ` David Miller
2017-05-23 15:00 ` [patch net-next 1/2] net/sched: properly assign RCU pointer in tcf_chain_tp_insert/remove David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.