aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Vrabel2013-02-13 21:18:58 -0600
committerGreg Kroah-Hartman2013-02-28 08:32:27 -0600
commitbd986521a6e35a301e45d2831501acc172fe2a8f (patch)
tree21bd20271578b412b002c13f396750426f5ea08a
parent436d1b8ff7eb7ac9e2569ad780c33bd4287d0526 (diff)
downloadkernel-common-bd986521a6e35a301e45d2831501acc172fe2a8f.tar.gz
kernel-common-bd986521a6e35a301e45d2831501acc172fe2a8f.tar.xz
kernel-common-bd986521a6e35a301e45d2831501acc172fe2a8f.zip
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/xen-netback/interface.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 5925e0b93bd..8eaf0e2aaf2 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -132,6 +132,7 @@ static void xenvif_up(struct xenvif *vif)
132static void xenvif_down(struct xenvif *vif) 132static void xenvif_down(struct xenvif *vif)
133{ 133{
134 disable_irq(vif->irq); 134 disable_irq(vif->irq);
135 del_timer_sync(&vif->credit_timeout);
135 xen_netbk_deschedule_xenvif(vif); 136 xen_netbk_deschedule_xenvif(vif);
136 xen_netbk_remove_xenvif(vif); 137 xen_netbk_remove_xenvif(vif);
137} 138}
@@ -362,8 +363,6 @@ void xenvif_disconnect(struct xenvif *vif)
362 atomic_dec(&vif->refcnt); 363 atomic_dec(&vif->refcnt);
363 wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); 364 wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0);
364 365
365 del_timer_sync(&vif->credit_timeout);
366
367 if (vif->irq) 366 if (vif->irq)
368 unbind_from_irqhandler(vif->irq, vif); 367 unbind_from_irqhandler(vif->irq, vif);
369 368