diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/ucm.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/ucma.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 13 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 13 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 2 |
5 files changed, 32 insertions, 1 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index d7a6881b571d..b25675faaaf5 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/cdev.h> | 45 | #include <linux/cdev.h> |
46 | #include <linux/idr.h> | 46 | #include <linux/idr.h> |
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include <linux/smp_lock.h> | ||
48 | 49 | ||
49 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
50 | 51 | ||
@@ -1159,6 +1160,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp) | |||
1159 | { | 1160 | { |
1160 | struct ib_ucm_file *file; | 1161 | struct ib_ucm_file *file; |
1161 | 1162 | ||
1163 | cycle_kernel_lock(); | ||
1162 | file = kmalloc(sizeof(*file), GFP_KERNEL); | 1164 | file = kmalloc(sizeof(*file), GFP_KERNEL); |
1163 | if (!file) | 1165 | if (!file) |
1164 | return -ENOMEM; | 1166 | return -ENOMEM; |
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index ca4cf3a511ab..195f97302fe5 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/in.h> | 38 | #include <linux/in.h> |
39 | #include <linux/in6.h> | 39 | #include <linux/in6.h> |
40 | #include <linux/miscdevice.h> | 40 | #include <linux/miscdevice.h> |
41 | #include <linux/smp_lock.h> | ||
41 | 42 | ||
42 | #include <rdma/rdma_user_cm.h> | 43 | #include <rdma/rdma_user_cm.h> |
43 | #include <rdma/ib_marshall.h> | 44 | #include <rdma/ib_marshall.h> |
@@ -1156,6 +1157,7 @@ static int ucma_open(struct inode *inode, struct file *filp) | |||
1156 | if (!file) | 1157 | if (!file) |
1157 | return -ENOMEM; | 1158 | return -ENOMEM; |
1158 | 1159 | ||
1160 | lock_kernel(); | ||
1159 | INIT_LIST_HEAD(&file->event_list); | 1161 | INIT_LIST_HEAD(&file->event_list); |
1160 | INIT_LIST_HEAD(&file->ctx_list); | 1162 | INIT_LIST_HEAD(&file->ctx_list); |
1161 | init_waitqueue_head(&file->poll_wait); | 1163 | init_waitqueue_head(&file->poll_wait); |
@@ -1163,6 +1165,7 @@ static int ucma_open(struct inode *inode, struct file *filp) | |||
1163 | 1165 | ||
1164 | filp->private_data = file; | 1166 | filp->private_data = file; |
1165 | file->filp = filp; | 1167 | file->filp = filp; |
1168 | unlock_kernel(); | ||
1166 | return 0; | 1169 | return 0; |
1167 | } | 1170 | } |
1168 | 1171 | ||
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 840ede9ae965..208c7f34323c 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -777,6 +777,19 @@ static long ib_umad_compat_ioctl(struct file *filp, unsigned int cmd, | |||
777 | } | 777 | } |
778 | #endif | 778 | #endif |
779 | 779 | ||
780 | /* | ||
781 | * ib_umad_open() does not need the BKL: | ||
782 | * | ||
783 | * - umad_port[] accesses are protected by port_lock, the | ||
784 | * ib_umad_port structures are properly reference counted, and | ||
785 | * everything else is purely local to the file being created, so | ||
786 | * races against other open calls are not a problem; | ||
787 | * - the ioctl method does not affect any global state outside of the | ||
788 | * file structure being operated on; | ||
789 | * - the port is added to umad_port[] as the last part of module | ||
790 | * initialization so the open method will either immediately run | ||
791 | * -ENXIO, or all required initialization will be done. | ||
792 | */ | ||
780 | static int ib_umad_open(struct inode *inode, struct file *filp) | 793 | static int ib_umad_open(struct inode *inode, struct file *filp) |
781 | { | 794 | { |
782 | struct ib_umad_port *port; | 795 | struct ib_umad_port *port; |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index caed42bf7ef5..0f34858e31e7 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -610,6 +610,18 @@ static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma) | |||
610 | return file->device->ib_dev->mmap(file->ucontext, vma); | 610 | return file->device->ib_dev->mmap(file->ucontext, vma); |
611 | } | 611 | } |
612 | 612 | ||
613 | /* | ||
614 | * ib_uverbs_open() does not need the BKL: | ||
615 | * | ||
616 | * - dev_table[] accesses are protected by map_lock, the | ||
617 | * ib_uverbs_device structures are properly reference counted, and | ||
618 | * everything else is purely local to the file being created, so | ||
619 | * races against other open calls are not a problem; | ||
620 | * - there is no ioctl method to race against; | ||
621 | * - the device is added to dev_table[] as the last part of module | ||
622 | * initialization, the open method will either immediately run | ||
623 | * -ENXIO, or all required initialization will be done. | ||
624 | */ | ||
613 | static int ib_uverbs_open(struct inode *inode, struct file *filp) | 625 | static int ib_uverbs_open(struct inode *inode, struct file *filp) |
614 | { | 626 | { |
615 | struct ib_uverbs_device *dev; | 627 | struct ib_uverbs_device *dev; |
@@ -651,7 +663,6 @@ err_module: | |||
651 | 663 | ||
652 | err: | 664 | err: |
653 | kref_put(&dev->ref, ib_uverbs_release_dev); | 665 | kref_put(&dev->ref, ib_uverbs_release_dev); |
654 | |||
655 | return ret; | 666 | return ret; |
656 | } | 667 | } |
657 | 668 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index b472b15637f0..35f301c88b57 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/highmem.h> | 39 | #include <linux/highmem.h> |
40 | #include <linux/io.h> | 40 | #include <linux/io.h> |
41 | #include <linux/jiffies.h> | 41 | #include <linux/jiffies.h> |
42 | #include <linux/smp_lock.h> | ||
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
43 | 44 | ||
44 | #include "ipath_kernel.h" | 45 | #include "ipath_kernel.h" |
@@ -1815,6 +1816,7 @@ done: | |||
1815 | static int ipath_open(struct inode *in, struct file *fp) | 1816 | static int ipath_open(struct inode *in, struct file *fp) |
1816 | { | 1817 | { |
1817 | /* The real work is performed later in ipath_assign_port() */ | 1818 | /* The real work is performed later in ipath_assign_port() */ |
1819 | cycle_kernel_lock(); | ||
1818 | fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL); | 1820 | fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL); |
1819 | return fp->private_data ? 0 : -ENOMEM; | 1821 | return fp->private_data ? 0 : -ENOMEM; |
1820 | } | 1822 | } |