Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ba18b18 authored by Roland Dreier's avatar Roland Dreier
Browse files

RDMA/ucm: BKL is not needed for ib_ucm_open()



Remove explicit cycle_kernel_lock() call and document why the code is safe.

Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent f7a6117e
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@
#include <linux/cdev.h>
#include <linux/cdev.h>
#include <linux/idr.h>
#include <linux/idr.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>


#include <asm/uaccess.h>
#include <asm/uaccess.h>


@@ -1154,11 +1153,18 @@ static unsigned int ib_ucm_poll(struct file *filp,
	return mask;
	return mask;
}
}


/*
 * ib_ucm_open() does not need the BKL:
 *
 *  - no global state is referred to;
 *  - there is no ioctl method to race against;
 *  - no further module initialization is required for open to work
 *    after the device is registered.
 */
static int ib_ucm_open(struct inode *inode, struct file *filp)
static int ib_ucm_open(struct inode *inode, struct file *filp)
{
{
	struct ib_ucm_file *file;
	struct ib_ucm_file *file;


	cycle_kernel_lock();
	file = kmalloc(sizeof(*file), GFP_KERNEL);
	file = kmalloc(sizeof(*file), GFP_KERNEL);
	if (!file)
	if (!file)
		return -ENOMEM;
		return -ENOMEM;