From: Herbert Xu Date: Thu, 2 Jul 2009 23:03:55 +0000 (+0000) Subject: tun: Fix device unregister race X-Git-Tag: v2.6.31-rc3~70^2~9 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d23e43658aed286b885d398ff0810f04f6aae97f;p=pandora-kernel.git tun: Fix device unregister race It is currently possible for an asynchronous device unregister to cause the same tun device to be unregistered twice. This is because the unregister in tun_chr_close only checks whether __tun_get(tfile) != NULL. This however has nothing to do with whether the device has already been unregistered. All it tells you is whether __tun_detach has been called. This patch fixes this by using the most obvious thing to test whether the device has been unregistered. It also moves __tun_detach outside of rtnl_unlock since nothing that it does requires that lock. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- Reading git-diff-tree failed