diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-06 19:46:57 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-06 19:46:57 -0400 |
| commit | eeaecb8619fb679006ab24a11ed292e37c74703c (patch) | |
| tree | 13e8028af87707eedb938a0f4937aa9e74f1a313 /drivers/net/tun.c | |
| parent | dc53fffc105f68cb08ca872acd51550e89aa2e67 (diff) | |
| parent | 0ca1b08eba627b4245efd0f71b55a062bf163777 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (39 commits)
Revert "p54: Use SKB list handling helpers instead of by-hand code."
sctp: fix warning at inet_sock_destruct() while release sctp socket
tun/tap: Fix crashes if open() /dev/net/tun and then poll() it.
dsa: fix 88e6xxx statistics counter snapshotting
forcedeth: Fix NAPI race.
drivers/net/smsc911x.c: Fix resource size off by 1 error
pcnet_cs: add new id
bnx2x: Fix the maximal values of coalescing timeouts.
bnx2x: Disable HC coalescing when setting timeout to zero.
tun: Fix device unregister race
be2net: fix spurious interrupt handling in intx mode
e1000e: disable K1 at 1000Mbps for 82577/82578
e1000e: delay second read of PHY_STATUS register on failure of first read
e1000e: prevent NVM corruption on sectors larger than 4K
e1000e: do not write SmartSpeed register bits on parts without support
e1000e: delay after LCD reset and proper checks for PHY configuration done
e1000e: PHY loopback broken on 82578
ixgbe: Not allow 8259x unsupported wol options change from ethtool
ixgbe: fix inconsistent SFP/SFP+ failure results.
ixgbe: fix regression on some 82598 adapters
...
Diffstat (limited to 'drivers/net/tun.c')
| -rw-r--r-- | drivers/net/tun.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 11a0ba47b677..027f7aba26af 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -486,12 +486,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
| 486 | { | 486 | { |
| 487 | struct tun_file *tfile = file->private_data; | 487 | struct tun_file *tfile = file->private_data; |
| 488 | struct tun_struct *tun = __tun_get(tfile); | 488 | struct tun_struct *tun = __tun_get(tfile); |
| 489 | struct sock *sk = tun->sk; | 489 | struct sock *sk; |
| 490 | unsigned int mask = 0; | 490 | unsigned int mask = 0; |
| 491 | 491 | ||
| 492 | if (!tun) | 492 | if (!tun) |
| 493 | return POLLERR; | 493 | return POLLERR; |
| 494 | 494 | ||
| 495 | sk = tun->sk; | ||
| 496 | |||
| 495 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); | 497 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); |
| 496 | 498 | ||
| 497 | poll_wait(file, &tun->socket.wait, wait); | 499 | poll_wait(file, &tun->socket.wait, wait); |
| @@ -1324,20 +1326,22 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
| 1324 | struct tun_file *tfile = file->private_data; | 1326 | struct tun_file *tfile = file->private_data; |
| 1325 | struct tun_struct *tun; | 1327 | struct tun_struct *tun; |
| 1326 | 1328 | ||
| 1327 | |||
| 1328 | rtnl_lock(); | ||
| 1329 | tun = __tun_get(tfile); | 1329 | tun = __tun_get(tfile); |
| 1330 | if (tun) { | 1330 | if (tun) { |
| 1331 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); | 1331 | struct net_device *dev = tun->dev; |
| 1332 | |||
| 1333 | DBG(KERN_INFO "%s: tun_chr_close\n", dev->name); | ||
| 1332 | 1334 | ||
| 1333 | __tun_detach(tun); | 1335 | __tun_detach(tun); |
| 1334 | 1336 | ||
| 1335 | /* If desireable, unregister the netdevice. */ | 1337 | /* If desireable, unregister the netdevice. */ |
| 1336 | if (!(tun->flags & TUN_PERSIST)) | 1338 | if (!(tun->flags & TUN_PERSIST)) { |
| 1337 | unregister_netdevice(tun->dev); | 1339 | rtnl_lock(); |
| 1338 | 1340 | if (dev->reg_state == NETREG_REGISTERED) | |
| 1341 | unregister_netdevice(dev); | ||
| 1342 | rtnl_unlock(); | ||
| 1343 | } | ||
| 1339 | } | 1344 | } |
| 1340 | rtnl_unlock(); | ||
| 1341 | 1345 | ||
| 1342 | tun = tfile->tun; | 1346 | tun = tfile->tun; |
| 1343 | if (tun) | 1347 | if (tun) |
