On 29 October 2016 at 21:33, Pravin B Shelar <pshe...@ovn.org> wrote: > This patch is similar to earlier vxlan patch. > Lisp device close operation frees lisp socket. This > operation can race with lisp-xmit function which > dereferences lisp socket. Following patch uses RCU > mechanism to avoid this situation. > > Signed-off-by: Pravin B Shelar <pshe...@ovn.org>
Thanks, one style comment below. Otherwise: Acked-by: Joe Stringer <j...@ovn.org> > @@ -442,11 +449,13 @@ static int lisp_open(struct net_device *dev) > struct lisp_dev *lisp = netdev_priv(dev); > struct udp_tunnel_sock_cfg tunnel_cfg; > struct net *net = lisp->net; > + struct socket *sock; > > - lisp->sock = create_sock(net, false, lisp->dst_port); > - if (IS_ERR(lisp->sock)) > - return PTR_ERR(lisp->sock); > + sock = create_sock(net, false, lisp->dst_port); > + if (IS_ERR(sock)) > + return PTR_ERR(sock); > > + rcu_assign_pointer(lisp->sock, sock); > /* Mark socket as an encapsulation socket */ > tunnel_cfg.sk_user_data = dev; > tunnel_cfg.encap_type = 1; At the end of lisp_open(), we pass lisp->sock directly to another function. I think it's ok, but you could remove all direct dereferences of 'lisp->sock' if you rolled in this incremental patch: diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c index 193196c7e328..15f851de9ff4 100644 --- a/datapath/linux/compat/lisp.c +++ b/datapath/linux/compat/lisp.c @@ -461,7 +461,7 @@ static int lisp_open(struct net_device *dev) tunnel_cfg.encap_type = 1; tunnel_cfg.encap_rcv = lisp_rcv; tunnel_cfg.encap_destroy = NULL; - setup_udp_tunnel_sock(net, lisp->sock, &tunnel_cfg); + setup_udp_tunnel_sock(net, sock, &tunnel_cfg); return 0; } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev