[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALnjE+oDwU46NiK-AyB-dJZVrWT-pot_v+obv+MxgZU0xNwbRw@mail.gmail.com>
Date: Sat, 13 Jul 2013 12:21:52 -0700
From: Pravin Shelar <pshelar@...ira.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net] vxlan: add necessary locking on device removal
On Sat, Jul 13, 2013 at 10:18 AM, Stephen Hemminger
<stephen@...workplumber.org> wrote:
> The socket management is now done in workqueue (outside of RTNL)
> and protected by vn->sock_lock. There were two possible bugs, first
> the vxlan device was removed from the VNI hash table per socket without
> holding lock. And there was a race when device is created and the workqueue
> could run after deletion.
>
> Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
>
> --- a/drivers/net/vxlan.c 2013-07-08 16:31:50.080744429 -0700
> +++ b/drivers/net/vxlan.c 2013-07-10 20:15:47.337653899 -0700
> @@ -1767,9 +1767,15 @@ static int vxlan_newlink(struct net *net
>
> static void vxlan_dellink(struct net_device *dev, struct list_head *head)
> {
> + struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
> struct vxlan_dev *vxlan = netdev_priv(dev);
>
> + flush_workqueue(vxlan_wq);
> +
Doesn't this create dependency on sock_work thread while holding RTNL.
If so it can result in deadlock.
> + spin_lock(&vn->sock_lock);
> hlist_del_rcu(&vxlan->hlist);
> + spin_unlock(&vn->sock_lock);
> +
> list_del(&vxlan->next);
> unregister_netdevice_queue(dev, head);
> }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists