Skip to content

Commit

Permalink
HID: remove BKL from hiddev_ioctl_usage()
Browse files Browse the repository at this point in the history
The race between ioctl and disconnect is guarded by low level
hiddev device mutex (existancelock) since the commit
0790340 ("HID: hiddev cleanup -- handle all error conditions
properly"), therefore we can remove the lock_kernel() from
hiddev_ioctl_usage().

Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Nov 5, 2009
1 parent 80f5069 commit 6c85773
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
uref_multi = kmalloc(sizeof(struct hiddev_usage_ref_multi), GFP_KERNEL);
if (!uref_multi)
return -ENOMEM;
lock_kernel();
uref = &uref_multi->uref;
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
if (copy_from_user(uref_multi, user_arg,
Expand Down Expand Up @@ -528,7 +527,6 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,

case HIDIOCGCOLLECTIONINDEX:
i = field->usage[uref->usage_index].collection_index;
unlock_kernel();
kfree(uref_multi);
return i;
case HIDIOCGUSAGES:
Expand All @@ -547,15 +545,12 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
}

goodreturn:
unlock_kernel();
kfree(uref_multi);
return 0;
fault:
unlock_kernel();
kfree(uref_multi);
return -EFAULT;
inval:
unlock_kernel();
kfree(uref_multi);
return -EINVAL;
}
Expand Down

0 comments on commit 6c85773

Please sign in to comment.