summaryrefslogtreecommitdiffstats
path: root/drivers/uio
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 13:42:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 13:42:14 -0700
commit2bea2e4abf2fe8bc7384103aeaad91089109cfba (patch)
tree3f7cf9712fa8998213bf2f7ed97b40e65946cd92 /drivers/uio
parenta0bfb673dca8a2b4324fe11e678ec6d6a9ad67e0 (diff)
parent0d4a7bc12ffecd3ba41dd94179cc5b272b71ce8a (diff)
downloadop-kernel-dev-2bea2e4abf2fe8bc7384103aeaad91089109cfba.zip
op-kernel-dev-2bea2e4abf2fe8bc7384103aeaad91089109cfba.tar.gz
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: UIO: BKL removal
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 5dccf05..f9b4647 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -47,6 +47,9 @@ static struct uio_class {
struct class *class;
} *uio_class;
+/* Protect idr accesses */
+static DEFINE_MUTEX(minor_lock);
+
/*
* attributes
*/
@@ -239,7 +242,6 @@ static void uio_dev_del_attributes(struct uio_device *idev)
static int uio_get_minor(struct uio_device *idev)
{
- static DEFINE_MUTEX(minor_lock);
int retval = -ENOMEM;
int id;
@@ -261,7 +263,9 @@ exit:
static void uio_free_minor(struct uio_device *idev)
{
+ mutex_lock(&minor_lock);
idr_remove(&uio_idr, idev->minor);
+ mutex_unlock(&minor_lock);
}
/**
@@ -305,8 +309,9 @@ static int uio_open(struct inode *inode, struct file *filep)
struct uio_listener *listener;
int ret = 0;
- lock_kernel();
+ mutex_lock(&minor_lock);
idev = idr_find(&uio_idr, iminor(inode));
+ mutex_unlock(&minor_lock);
if (!idev) {
ret = -ENODEV;
goto out;
@@ -332,18 +337,15 @@ static int uio_open(struct inode *inode, struct file *filep)
if (ret)
goto err_infoopen;
}
- unlock_kernel();
return 0;
err_infoopen:
-
kfree(listener);
-err_alloc_listener:
+err_alloc_listener:
module_put(idev->owner);
out:
- unlock_kernel();
return ret;
}
OpenPOWER on IntegriCloud