diff options
author | Igor Druzhinin <igor.druzhinin@citrix.com> | 2017-01-17 21:49:38 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-18 21:11:20 +0100 |
commit | f16f1df65f1cf139ff9e9f84661e6573d6bb27fc (patch) | |
tree | 6f3d46c2653ace73426558feacde02c97c7adbeb /drivers/net/xen-netback/xenbus.c | |
parent | xen-netback: fix memory leaks on XenBus disconnect (diff) | |
download | linux-f16f1df65f1cf139ff9e9f84661e6573d6bb27fc.tar.xz linux-f16f1df65f1cf139ff9e9f84661e6573d6bb27fc.zip |
xen-netback: protect resource cleaning on XenBus disconnect
vif->lock is used to protect statistics gathering agents from using the
queue structure during cleaning.
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/xenbus.c')
-rw-r--r-- | drivers/net/xen-netback/xenbus.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 34e4af9272ea..85b742e1c42f 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -503,9 +503,11 @@ static void backend_disconnect(struct backend_info *be) for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index) xenvif_deinit_queue(&be->vif->queues[queue_index]); + spin_lock(&be->vif->lock); vfree(be->vif->queues); be->vif->num_queues = 0; be->vif->queues = NULL; + spin_unlock(&be->vif->lock); xenvif_disconnect_ctrl(be->vif); } |