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

Commit 26ce4f06 authored by Jonathan Corbet's avatar Jonathan Corbet
Browse files

adb: BKL pushdown



Put explicit lock_kernel() calls in adb_open().  The fact that
adb_release() already has them suggests this is necessary.

Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 3462032d
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
static int adb_open(struct inode *inode, struct file *file)
{
	struct adbdev_state *state;
	int ret = 0;

	if (iminor(inode) > 0 || adb_controller == NULL)
		return -ENXIO;
	lock_kernel();
	if (iminor(inode) > 0 || adb_controller == NULL) {
		ret = -ENXIO;
		goto out;
	}
	state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
	if (state == 0)
		return -ENOMEM;
	if (state == 0) {
		ret = -ENOMEM;
		goto out;
	}
	file->private_data = state;
	spin_lock_init(&state->lock);
	atomic_set(&state->n_pending, 0);
@@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
	init_waitqueue_head(&state->wait_queue);
	state->inuse = 1;

	return 0;
out:
	unlock_kernel();
	return ret;
}

static int adb_release(struct inode *inode, struct file *file)