diff options
-rw-r--r-- | drivers/net/tun.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ce5af2aa8843..4c0c5972a489 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -782,18 +782,21 @@ static int tun_chr_fasync(int fd, struct file *file, int on) | |||
782 | 782 | ||
783 | DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); | 783 | DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); |
784 | 784 | ||
785 | lock_kernel(); | ||
785 | if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) | 786 | if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) |
786 | return ret; | 787 | goto out; |
787 | 788 | ||
788 | if (on) { | 789 | if (on) { |
789 | ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); | 790 | ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); |
790 | if (ret) | 791 | if (ret) |
791 | return ret; | 792 | goto out; |
792 | tun->flags |= TUN_FASYNC; | 793 | tun->flags |= TUN_FASYNC; |
793 | } else | 794 | } else |
794 | tun->flags &= ~TUN_FASYNC; | 795 | tun->flags &= ~TUN_FASYNC; |
795 | 796 | ret = 0; | |
796 | return 0; | 797 | out: |
798 | unlock_kernel(); | ||
799 | return ret; | ||
797 | } | 800 | } |
798 | 801 | ||
799 | static int tun_chr_open(struct inode *inode, struct file * file) | 802 | static int tun_chr_open(struct inode *inode, struct file * file) |