cleanup accelerators list on netfront unload diff -r fdfd708d2ec4 drivers/xen/netfront/accel.c --- a/drivers/xen/netfront/accel.c Wed Oct 24 15:38:35 2007 +0100 +++ b/drivers/xen/netfront/accel.c Wed Oct 24 16:25:57 2007 +0100 @@ -75,6 +75,24 @@ void netif_init_accel(void) spin_lock_init(&accelerators_lock); } +void netif_exit_accel(void) +{ + struct netfront_accelerator *accelerator, *tmp; + unsigned flags; + + spin_lock_irqsave(&accelerators_lock, flags); + + list_for_each_entry_safe(accelerator, tmp, &accelerators_list, link) { + BUG_ON(!list_empty(&accelerator->vif_states)); + + list_del(&accelerator->link); + kfree(accelerator->frontend); + kfree(accelerator); + } + + spin_unlock_irqrestore(&accelerators_lock, flags); +} + /* * Initialise the accel_vif_state field in the netfront state diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.c --- a/drivers/xen/netfront/netfront.c Wed Oct 24 15:38:35 2007 +0100 +++ b/drivers/xen/netfront/netfront.c Wed Oct 24 15:57:26 2007 +0100 @@ -2212,6 +2212,8 @@ static void __exit netif_exit(void) unregister_inetaddr_notifier(¬ifier_inetdev); + netif_exit_accel(); + return xenbus_unregister_driver(&netfront); } module_exit(netif_exit); diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.h --- a/drivers/xen/netfront/netfront.h Wed Oct 24 15:38:35 2007 +0100 +++ b/drivers/xen/netfront/netfront.h Wed Oct 24 16:11:32 2007 +0100 @@ -306,6 +306,8 @@ int netfront_load_accelerator(struct net extern void netif_init_accel(void); +extern +void netif_exit_accel(void); extern void init_accelerator_vif(struct netfront_info *np,