linux/net
Daniel Lezcano 93ee31f14f [NET]: Fix free_netdev on register_netdev failure.
Point 1:
The unregistering of a network device schedule a netdev_run_todo.
This function calls dev->destructor when it is set and the
destructor calls free_netdev.

Point 2:
In the case of an initialization of a network device the usual code
is:
 * alloc_netdev
 * register_netdev
    -> if this one fails, call free_netdev and exit with error.

Point 3:
In the register_netdevice function at the later state, when the device
is at the registered state, a call to the netdevice_notifiers is made.
If one of the notification falls into an error, a rollback to the
registered state is done using unregister_netdevice.

Conclusion:
When a network device fails to register during initialization because
one network subsystem returned an error during a notification call
chain, the network device is freed twice because of fact 1 and fact 2.
The second free_netdev will be done with an invalid pointer.

Proposed solution:
The following patch move all the code of unregister_netdevice *except*
the call to net_set_todo, to a new function "rollback_registered".

The following functions are changed in this way:
 * register_netdevice: calls rollback_registered when a notification fails
 * unregister_netdevice: calls rollback_register + net_set_todo, the call
                         order to net_set_todo is changed because it is the
                         latest now. Since it justs add an element to a list
                         that should not break anything.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-30 21:16:18 -07:00
..
9p [9P]: Fix missing unlock before return in p9_mux_poll_start 2007-10-23 21:27:54 -07:00
802
8021q
appletalk
atm [BR2684]: get rid of broken header code. 2007-10-17 19:39:22 -07:00
ax25 Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
bluetooth [Bluetooth] Convert RFCOMM to use kthread API 2007-10-22 02:59:49 -07:00
bridge Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
core [NET]: Fix free_netdev on register_netdev failure. 2007-10-30 21:16:18 -07:00
dccp [CCID2/3]: Initialisation assignments of 0 are redundant 2007-10-24 10:53:01 -02:00
decnet
econet
ethernet [NET]: Validate device addr prior to interface-up 2007-10-23 21:27:50 -07:00
ieee80211 SG: Change sg_set_page() to take length and offset argument 2007-10-24 11:20:47 +02:00
ipv4 Kbuild/doc: fix links to Documentation files 2007-10-30 14:26:30 -07:00
ipv6 [TCP] MD5: Remove some more unnecessary casting. 2007-10-29 22:37:27 -07:00
ipx
irda [IRDA]: Make ircomm_tty static. 2007-10-26 03:56:43 -07:00
iucv Fix misspellings of "system", "controller", "interrupt" and "necessary". 2007-10-19 23:10:43 +02:00
key
lapb
llc Use helpers to obtain task pid in printks 2007-10-19 11:53:43 -07:00
mac80211 [PATCH] mac80211: fix printk warning on 64-bit 2007-10-26 00:14:29 -04:00
netfilter Kbuild/doc: fix links to Documentation files 2007-10-30 14:26:30 -07:00
netlabel [NetLabel]: correct usage of RCU locking 2007-10-26 04:29:08 -07:00
netlink [NET]: Marking struct pernet_operations __net_initdata was inappropriate 2007-10-26 22:54:53 -07:00
netrom
packet [PACKET]: Kill unused pg_vec_endpage() function 2007-10-18 21:58:19 -07:00
rfkill get rid of input BIT* duplicate defines 2007-10-19 11:53:42 -07:00
rose
rxrpc [CRYPTO] users: Fix up scatterlist conversion errors 2007-10-27 00:52:07 -07:00
sched [NET_CLS_ACT]: Use skb_act_clone 2007-10-26 02:47:54 -07:00
sctp SCTP endianness annotations regression 2007-10-29 07:41:32 -07:00
sunrpc [SUNRPC]: fix rpc debugging 2007-10-30 01:07:15 -07:00
tipc
unix pid namespaces: changes to show virtual ids to user 2007-10-19 11:53:40 -07:00
wanrouter
wireless
x25
xfrm [IPSEC]: Fix scatterlist handling in skb_icv_walk(). 2007-10-26 00:39:27 -07:00
compat.c
Kconfig
Makefile
nonet.c
socket.c [NET]: Fix error reporting in sys_socketpair(). 2007-10-29 22:37:34 -07:00
sysctl_net.c
TUNABLE