diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-05-16 20:01:12 (GMT) |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-06-20 20:05:51 (GMT) |
commit | 057e7c7ff9f91a36a761588c53826bd6a710aeba (patch) | |
tree | 001de53a930643f3b00f0cc83ea58670a9815c9f /drivers/infiniband/core/user_mad.c | |
parent | 65f37b790bd7ba15413838579470296a709c45e6 (diff) | |
download | linux-fsl-qoriq-057e7c7ff9f91a36a761588c53826bd6a710aeba.tar.xz |
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/user_mad.c')
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db5..1fc1794 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -47,6 +47,7 @@ #include <linux/kref.h> #include <linux/compat.h> #include <linux/semaphore.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> @@ -783,14 +784,17 @@ static int ib_umad_open(struct inode *inode, struct file *filp) struct ib_umad_file *file; int ret = 0; + lock_kernel(); spin_lock(&port_lock); port = umad_port[iminor(inode) - IB_UMAD_MINOR_BASE]; if (port) kref_get(&port->umad_dev->ref); spin_unlock(&port_lock); - if (!port) + if (!port) { + unlock_kernel(); return -ENXIO; + } mutex_lock(&port->file_mutex); @@ -819,6 +823,7 @@ static int ib_umad_open(struct inode *inode, struct file *filp) out: mutex_unlock(&port->file_mutex); + unlock_kernel(); return ret; } |