aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-18 05:39:39 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-18 05:39:39 -0400
commit49997d75152b3d23c53b0fa730599f2f74c92c65 (patch)
tree46e93126170d02cfec9505172e545732c1b69656 /drivers/net/tun.c
parenta0c80b80e0fb48129e4e9d6a9ede914f9ff1850d (diff)
parent5b664cb235e97afbf34db9c4d77f08ebd725335e (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: Documentation/powerpc/booting-without-of.txt drivers/atm/Makefile drivers/net/fs_enet/fs_enet-main.c drivers/pci/pci-acpi.c net/8021q/vlan.c net/iucv/iucv.c
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 901551c8ca0e..a82b32b40131 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -44,6 +44,7 @@
44#include <linux/kernel.h> 44#include <linux/kernel.h>
45#include <linux/major.h> 45#include <linux/major.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/smp_lock.h>
47#include <linux/poll.h> 48#include <linux/poll.h>
48#include <linux/fcntl.h> 49#include <linux/fcntl.h>
49#include <linux/init.h> 50#include <linux/init.h>
@@ -938,22 +939,26 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
938 939
939 DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); 940 DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on);
940 941
942 lock_kernel();
941 if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) 943 if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0)
942 return ret; 944 goto out;
943 945
944 if (on) { 946 if (on) {
945 ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); 947 ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0);
946 if (ret) 948 if (ret)
947 return ret; 949 goto out;
948 tun->flags |= TUN_FASYNC; 950 tun->flags |= TUN_FASYNC;
949 } else 951 } else
950 tun->flags &= ~TUN_FASYNC; 952 tun->flags &= ~TUN_FASYNC;
951 953 ret = 0;
952 return 0; 954out:
955 unlock_kernel();
956 return ret;
953} 957}
954 958
955static int tun_chr_open(struct inode *inode, struct file * file) 959static int tun_chr_open(struct inode *inode, struct file * file)
956{ 960{
961 cycle_kernel_lock();
957 DBG1(KERN_INFO "tunX: tun_chr_open\n"); 962 DBG1(KERN_INFO "tunX: tun_chr_open\n");
958 file->private_data = NULL; 963 file->private_data = NULL;
959 return 0; 964 return 0;