Commit deed49fb authored by Thomas Gleixner's avatar Thomas Gleixner Committed by David S. Miller

net: Remove BKL from tun

The lock_kernel/unlock_kernel() in cycle_kernel_lock() which is called
in tun_chr_open() is not serializing against anything and safe to
remove.

tun_chr_fasync() is serialized by get/put_tun() and fasync_helper()
has no dependency on BKL. The modification of tun->flags is racy with
and without the BKL so removing it does not make it worse.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 421355de
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -1285,7 +1284,6 @@ static int tun_chr_fasync(int fd, struct file *file, int on) ...@@ -1285,7 +1284,6 @@ 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); 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) if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0)
goto out; goto out;
...@@ -1298,7 +1296,6 @@ static int tun_chr_fasync(int fd, struct file *file, int on) ...@@ -1298,7 +1296,6 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
tun->flags &= ~TUN_FASYNC; tun->flags &= ~TUN_FASYNC;
ret = 0; ret = 0;
out: out:
unlock_kernel();
tun_put(tun); tun_put(tun);
return ret; return ret;
} }
...@@ -1306,7 +1303,7 @@ static int tun_chr_fasync(int fd, struct file *file, int on) ...@@ -1306,7 +1303,7 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
static int tun_chr_open(struct inode *inode, struct file * file) static int tun_chr_open(struct inode *inode, struct file * file)
{ {
struct tun_file *tfile; struct tun_file *tfile;
cycle_kernel_lock();
DBG1(KERN_INFO "tunX: tun_chr_open\n"); DBG1(KERN_INFO "tunX: tun_chr_open\n");
tfile = kmalloc(sizeof(*tfile), GFP_KERNEL); tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment