Skip to contentSkip to conversation

netfront: unregister net device at backend_changed() if network_connect() failed

PATCH Joe Jin 1 participant 1 message Nov 19, 2008

lore
Share & tools
lore

Joe Jin

author
#0 lore raw
Quoted 3 lines

My point is, if you unregister_netdev() on failed network_connect(), and then do it unconditionally again in netfront_remove(), you will BUG_ON() in unregister_netdevice().

Sorry I dont notice that
Could we add a test in netfront_remove like below? static int __devexit netfront_remove(struct xenbus_device *dev) {
<--snip-->

      if (info->netdev->reg_state == NETREG_REGISTERED)
           unregister_netdev(info->netdev);

<--snip-->
}

This will avoid the crash when call netfront_remove.

Thanks,
Joe