diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-05-16 16:01:12 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-06-20 16:05:51 -0400 |
commit | 057e7c7ff9f91a36a761588c53826bd6a710aeba (patch) | |
tree | 001de53a930643f3b00f0cc83ea58670a9815c9f /drivers/infiniband | |
parent | 65f37b790bd7ba15413838579470296a709c45e6 (diff) |
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')
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db54eae4..1fc17940a765 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/kref.h> | 47 | #include <linux/kref.h> |
48 | #include <linux/compat.h> | 48 | #include <linux/compat.h> |
49 | #include <linux/semaphore.h> | 49 | #include <linux/semaphore.h> |
50 | #include <linux/smp_lock.h> | ||
50 | 51 | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | 53 | ||
@@ -783,14 +784,17 @@ static int ib_umad_open(struct inode *inode, struct file *filp) | |||
783 | struct ib_umad_file *file; | 784 | struct ib_umad_file *file; |
784 | int ret = 0; | 785 | int ret = 0; |
785 | 786 | ||
787 | lock_kernel(); | ||
786 | spin_lock(&port_lock); | 788 | spin_lock(&port_lock); |
787 | port = umad_port[iminor(inode) - IB_UMAD_MINOR_BASE]; | 789 | port = umad_port[iminor(inode) - IB_UMAD_MINOR_BASE]; |
788 | if (port) | 790 | if (port) |
789 | kref_get(&port->umad_dev->ref); | 791 | kref_get(&port->umad_dev->ref); |
790 | spin_unlock(&port_lock); | 792 | spin_unlock(&port_lock); |
791 | 793 | ||
792 | if (!port) | 794 | if (!port) { |
795 | unlock_kernel(); | ||
793 | return -ENXIO; | 796 | return -ENXIO; |
797 | } | ||
794 | 798 | ||
795 | mutex_lock(&port->file_mutex); | 799 | mutex_lock(&port->file_mutex); |
796 | 800 | ||
@@ -819,6 +823,7 @@ static int ib_umad_open(struct inode *inode, struct file *filp) | |||
819 | 823 | ||
820 | out: | 824 | out: |
821 | mutex_unlock(&port->file_mutex); | 825 | mutex_unlock(&port->file_mutex); |
826 | unlock_kernel(); | ||
822 | return ret; | 827 | return ret; |
823 | } | 828 | } |
824 | 829 | ||
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 @@ | |||
45 | #include <linux/file.h> | 45 | #include <linux/file.h> |
46 | #include <linux/mount.h> | 46 | #include <linux/mount.h> |
47 | #include <linux/cdev.h> | 47 | #include <linux/cdev.h> |
48 | #include <linux/smp_lock.h> | ||
48 | 49 | ||
49 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
50 | 51 | ||
@@ -616,14 +617,17 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) | |||
616 | struct ib_uverbs_file *file; | 617 | struct ib_uverbs_file *file; |
617 | int ret; | 618 | int ret; |
618 | 619 | ||
620 | lock_kernel(); | ||
619 | spin_lock(&map_lock); | 621 | spin_lock(&map_lock); |
620 | dev = dev_table[iminor(inode) - IB_UVERBS_BASE_MINOR]; | 622 | dev = dev_table[iminor(inode) - IB_UVERBS_BASE_MINOR]; |
621 | if (dev) | 623 | if (dev) |
622 | kref_get(&dev->ref); | 624 | kref_get(&dev->ref); |
623 | spin_unlock(&map_lock); | 625 | spin_unlock(&map_lock); |
624 | 626 | ||
625 | if (!dev) | 627 | if (!dev) { |
628 | unlock_kernel(); | ||
626 | return -ENXIO; | 629 | return -ENXIO; |
630 | } | ||
627 | 631 | ||
628 | if (!try_module_get(dev->ib_dev->owner)) { | 632 | if (!try_module_get(dev->ib_dev->owner)) { |
629 | ret = -ENODEV; | 633 | ret = -ENODEV; |
@@ -644,6 +648,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) | |||
644 | 648 | ||
645 | filp->private_data = file; | 649 | filp->private_data = file; |
646 | 650 | ||
651 | unlock_kernel(); | ||
647 | return 0; | 652 | return 0; |
648 | 653 | ||
649 | err_module: | 654 | err_module: |
@@ -651,7 +656,7 @@ err_module: | |||
651 | 656 | ||
652 | err: | 657 | err: |
653 | kref_put(&dev->ref, ib_uverbs_release_dev); | 658 | kref_put(&dev->ref, ib_uverbs_release_dev); |
654 | 659 | unlock_kernel(); | |
655 | return ret; | 660 | return ret; |
656 | } | 661 | } |
657 | 662 | ||