Skip to content

Commit

Permalink
[NET]: Remove notifier block from chain when register_netdevice_notif…
Browse files Browse the repository at this point in the history
…ier fails

Commit fcc5a03:

	[NET]: Allow netdev REGISTER/CHANGENAME events to fail

makes the register_netdevice_notifier() handle the error from the
NETDEV_REGISTER event, sent to the registering block.

The bad news is that in this case the notifier block is 
not removed from the list, but the error is returned to the 
caller. In case the caller is in module init function and 
handles this error this can abort the module loading. The
notifier block will be then removed from the kernel, but 
will be left in the list. Oops :(

I think that the notifier block should be removed from the
chain in case of error, regardless whether this error is 
handled by the caller or not. In the worst case (the error 
is _not_ handled) module will not receive the events any 
longer.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Nov 14, 2007
1 parent 8a85639 commit c67625a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,8 @@ int register_netdevice_notifier(struct notifier_block *nb)
nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
}
}

raw_notifier_chain_unregister(&netdev_chain, nb);
goto unlock;
}

Expand Down

0 comments on commit c67625a

Please sign in to comment.