Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> OK, I've had a look and it looks like the free_netdev call in
> ppp_shutdown_inteface is the problem. What's happening is that
> the todo list is being processed either on another CPU or by
> preemption in another context. As a result when the subsequent
> free_netdev is called the device hasn't yet been processed and
> is still in state UNREGISTERING.
>
> Why do we need to call free_netdev after unregistering the netdev
> from the drivers at all? What's wrong with calling it from run_todo
> itself?
Well I guess someone might want to reregister the net device :)
Here is a minimal fix for this problem.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
===== net/core/dev.c 1.141 vs edited =====
--- 1.141/net/core/dev.c 2004-05-23 06:45:55 +10:00
+++ edited/net/core/dev.c 2004-05-29 21:56:18 +10:00
@@ -2999,7 +2999,6 @@
case NETREG_UNREGISTERING:
netdev_unregister_sysfs(dev);
- dev->reg_state = NETREG_UNREGISTERED;
netdev_wait_allrefs(dev);
@@ -3015,6 +3014,7 @@
*/
if (dev->destructor)
dev->destructor(dev);
+ class_device_put(&dev->class_dev);
break;
default:
@@ -3140,6 +3140,8 @@
free_divert_blk(dev);
/* Finish processing unregister after unlock */
+ dev->reg_state = NETREG_UNREGISTERED;
+ class_device_get(&dev->class_dev);
net_set_todo(dev);
dev_put(dev);
|