Commit 1af46fd7 authored by Jonathan Corbet's avatar Jonathan Corbet

USB Monitor: BKL pushdown

Add explicit lock_kernel() calls to mon_bin_open()
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent b2f2ba01
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -527,14 +528,17 @@ static int mon_bin_open(struct inode *inode, struct file *file) ...@@ -527,14 +528,17 @@ static int mon_bin_open(struct inode *inode, struct file *file)
size_t size; size_t size;
int rc; int rc;
lock_kernel();
mutex_lock(&mon_lock); mutex_lock(&mon_lock);
if ((mbus = mon_bus_lookup(iminor(inode))) == NULL) { if ((mbus = mon_bus_lookup(iminor(inode))) == NULL) {
mutex_unlock(&mon_lock); mutex_unlock(&mon_lock);
unlock_kernel();
return -ENODEV; return -ENODEV;
} }
if (mbus != &mon_bus0 && mbus->u_bus == NULL) { if (mbus != &mon_bus0 && mbus->u_bus == NULL) {
printk(KERN_ERR TAG ": consistency error on open\n"); printk(KERN_ERR TAG ": consistency error on open\n");
mutex_unlock(&mon_lock); mutex_unlock(&mon_lock);
unlock_kernel();
return -ENODEV; return -ENODEV;
} }
...@@ -568,6 +572,7 @@ static int mon_bin_open(struct inode *inode, struct file *file) ...@@ -568,6 +572,7 @@ static int mon_bin_open(struct inode *inode, struct file *file)
file->private_data = rp; file->private_data = rp;
mutex_unlock(&mon_lock); mutex_unlock(&mon_lock);
unlock_kernel();
return 0; return 0;
err_allocbuff: err_allocbuff:
...@@ -576,6 +581,7 @@ err_allocvec: ...@@ -576,6 +581,7 @@ err_allocvec:
kfree(rp); kfree(rp);
err_alloc: err_alloc:
mutex_unlock(&mon_lock); mutex_unlock(&mon_lock);
unlock_kernel();
return rc; return rc;
} }
......
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