xen-netback: cancel the credit timer when taking the vif down
authorDavid Vrabel <david.vrabel@citrix.com>
Thu, 14 Feb 2013 03:18:58 +0000 (03:18 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Mar 2013 03:24:20 +0000 (03:24 +0000)
commitdb3521fa50cd7ccab57c6b5eb7a118637804af50
tree13a7361e68a979c798b782594ea6177704b288c5
parentaa067cfc66595a3a842ef56a9211a674ee136422
xen-netback: cancel the credit timer when taking the vif down

[ Upstream commit 3e55f8b306cf305832a4ac78aa82e1b40e818ece ]

If the credit timer is left armed after calling
xen_netbk_remove_xenvif(), then it may fire and attempt to schedule
the vif which will then oops as vif->netbk == NULL.

This may happen both in the fatal error path and during normal
disconnection from the front end.

The sequencing during shutdown is critical to ensure that: a)
vif->netbk doesn't become unexpectedly NULL; and b) the net device/vif
is not freed.

1. Mark as unschedulable (netif_carrier_off()).
2. Synchronously cancel the timer.
3. Remove the vif from the schedule list.
4. Remove it from it netback thread group.
5. Wait for vif->refcnt to become 0.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Christopher S. Aker <caker@theshore.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/xen-netback/interface.c