]> err.no Git - linux-2.6/blobdiff - drivers/net/tun.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
[linux-2.6] / drivers / net / tun.c
index 901551c8ca0ea1c34457a47f89f1c42f856d84c2..e6bbc639c2d0c8428cc28e29692760f549bf50ce 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/kernel.h>
 #include <linux/major.h>
 #include <linux/slab.h>
+#include <linux/smp_lock.h>
 #include <linux/poll.h>
 #include <linux/fcntl.h>
 #include <linux/init.h>
@@ -899,7 +900,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
                        return -EINVAL;
                rtnl_lock();
-               ret = update_filter(&tun->txflt, (void *) __user arg);
+               ret = update_filter(&tun->txflt, (void __user *)arg);
                rtnl_unlock();
                return ret;
 
@@ -938,22 +939,26 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
 
        DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on);
 
+       lock_kernel();
        if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0)
-               return ret;
+               goto out;
 
        if (on) {
                ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0);
                if (ret)
-                       return ret;
+                       goto out;
                tun->flags |= TUN_FASYNC;
        } else
                tun->flags &= ~TUN_FASYNC;
-
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int tun_chr_open(struct inode *inode, struct file * file)
 {
+       cycle_kernel_lock();
        DBG1(KERN_INFO "tunX: tun_chr_open\n");
        file->private_data = NULL;
        return 0;