]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
hv_netvsc: avoid deadlocks between rtnl lock and vf_use_cnt wait
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 15 Aug 2016 15:48:40 +0000 (17:48 +0200)
committerTim Gardner <tim.gardner@canonical.com>
Fri, 16 Sep 2016 17:08:45 +0000 (11:08 -0600)
commit5424f383b696b832ce4d5ea1f69a489baa853052
tree48015d8650e49c47e5cad6e9273e3b5a93e35240
parente2d7d2a8200c49c041a65c5a82184fa9ad4b8713
hv_netvsc: avoid deadlocks between rtnl lock and vf_use_cnt wait

BugLink: http://bugs.launchpad.net/bugs/1616677
Here is a deadlock scenario:
- netvsc_vf_up() schedules netvsc_notify_peers() work and quits.
- netvsc_vf_down() runs before netvsc_notify_peers() gets executed. As it
  is being executed from netdev notifier chain we hold rtnl lock when we
  get here.
- we enter while (atomic_read(&net_device_ctx->vf_use_cnt) != 0) loop and
  wait till netvsc_notify_peers() drops vf_use_cnt.
- netvsc_notify_peers() starts on some other CPU but netdev_notify_peers()
  will hang on rtnl_lock().
- deadlock!

Instead of introducing additional synchronization I suggest we drop
gwrk.dwrk completely and call NETDEV_NOTIFY_PEERS directly. As we're
acting under rtnl lock this is legitimate.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d072218f214929194db06069564495b6b9fff34a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc_drv.c