netns: foreach_netdev_safe is insufficient in default_device_exit
Eric W. Biederman authored

During network namespace teardown we either move or delete
all of the network devices associated with a network namespace.
In the case of veth devices deleting one will also delete it's
pair device.  If both devices are in the same network namespace
then for_each_netdev_safe is insufficient as next may point
to the second veth device we have deleted.

To avoid problems I do what we do in __rtnl_kill_links and
restart the scan of the device list, after we have deleted
a device.

Currently dev_change_netnamespace does not appear to suffer from
this problem, but wireless devices are also paired and likely
should be moved between network namespaces together.  So I have
errored on the side of caution and restart the scan of the network
devices in that case as well.
Signed-off-by: default avatarEric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
8eb79863
Name Last commit Last update
..
802 hippi: convert driver to net_device_ops
8021q vlan: fix convertion to net_device_ops
9p Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
appletalk net/appletalk: Remove redundant test
atm netdevice: Kill netdev->priv
ax25 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
bluetooth Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
bridge Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
can can: merge error paths
core netns: foreach_netdev_safe is insufficient in default_device_exit
dcb net: add DCNA attribute to the BCN interface for DCB
dccp dccp_diag: LISTEN sockets don't have CCIDs
decnet net: Make static
dsa net: Make static
econet netns: Use net_eq() to compare net-namespaces for optimization.
ethernet eth: Declare an optimized compare_ether_addr_64bits() function
ipv4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
ipv6 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
ipx net: '&' redux
irda irda: merge exit paths
iucv [S390] convert iucv printks to dev_xxx and pr_xxx macros.
key netns PF_KEY: per-netns /proc/pfkey
lapb [LAPB] net/lapb/lapb_iface.c: use LIST_HEAD instead of LIST_HEAD_INIT
llc net: remove redundant argument comments
mac80211 mac80211: implement dynamic power save
netfilter
netlabel
netlink
netrom
packet
phonet
rfkill
rose
rxrpc
sched
sctp
sunrpc
tipc
unix
wanrouter
wireless
x25
xfrm
Kconfig
Makefile
TUNABLE
compat.c
nonet.c
socket.c
sysctl_net.c