summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-16 14:01:12 -0600
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:05:51 -0600
commit057e7c7ff9f91a36a761588c53826bd6a710aeba (patch)
tree001de53a930643f3b00f0cc83ea58670a9815c9f /drivers/infiniband/core/uverbs_main.c
parent65f37b790bd7ba15413838579470296a709c45e6 (diff)
downloadlinux-057e7c7ff9f91a36a761588c53826bd6a710aeba.tar.gz
linux-057e7c7ff9f91a36a761588c53826bd6a710aeba.tar.bz2
linux-057e7c7ff9f91a36a761588c53826bd6a710aeba.zip
infiniband: more BKL pushdown
Be extra-cautious and protect the remaining open() functions. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index cc1afa28c181..8ede1e475ce6 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -45,6 +45,7 @@
#include <linux/file.h>
#include <linux/mount.h>
#include <linux/cdev.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
@@ -616,14 +617,17 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp)
struct ib_uverbs_file *file;
int ret;
+ lock_kernel();
spin_lock(&map_lock);
dev = dev_table[iminor(inode) - IB_UVERBS_BASE_MINOR];
if (dev)
kref_get(&dev->ref);
spin_unlock(&map_lock);
- if (!dev)
+ if (!dev) {
+ unlock_kernel();
return -ENXIO;
+ }
if (!try_module_get(dev->ib_dev->owner)) {
ret = -ENODEV;
@@ -644,6 +648,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp)
filp->private_data = file;
+ unlock_kernel();
return 0;
err_module:
@@ -651,7 +656,7 @@ err_module:
err:
kref_put(&dev->ref, ib_uverbs_release_dev);
-
+ unlock_kernel();
return ret;
}