From: Eric W. Biederman Date: Mon, 8 Jun 2009 07:44:31 +0000 (-0700) Subject: tun: Fix unregister race X-Git-Tag: v2.6.31-rc1~330^2~114 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0a4d0e5b5bfd271e6737f7c095994835b70d450;p=pandora-kernel.git tun: Fix unregister race It is possible for tun_chr_close to race with dellink on the a tun device. In which case if __tun_get runs before dellink but dellink runs before tun_chr_close calls unregister_netdevice we will attempt to unregister the netdevice after it is already gone. The two cases are already serialized on the rtnl_lock, so I have gone for the cheap simple fix of moving rtnl_lock to cover __tun_get in tun_chr_close. Eliminating the possibility of the tun device being unregistered between __tun_get and unregister_netdevice in tun_chr_close. Signed-off-by: Eric W. Biederman Tested-by: David Woodhouse Signed-off-by: David S. Miller --- Reading git-diff-tree failed