HID: remove BKL from hiddev_ioctl_usage()
The race between ioctl and disconnect is guarded by low level
hiddev device mutex (existancelock) since the commit
07903407
("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>
hifive-unleashed-5.1
parent
80f506918f
commit
6c85773043
|
@ -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);
|
uref_multi = kmalloc(sizeof(struct hiddev_usage_ref_multi), GFP_KERNEL);
|
||||||
if (!uref_multi)
|
if (!uref_multi)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
lock_kernel();
|
|
||||||
uref = &uref_multi->uref;
|
uref = &uref_multi->uref;
|
||||||
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
|
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
|
||||||
if (copy_from_user(uref_multi, user_arg,
|
if (copy_from_user(uref_multi, user_arg,
|
||||||
|
@ -528,7 +527,6 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
|
||||||
|
|
||||||
case HIDIOCGCOLLECTIONINDEX:
|
case HIDIOCGCOLLECTIONINDEX:
|
||||||
i = field->usage[uref->usage_index].collection_index;
|
i = field->usage[uref->usage_index].collection_index;
|
||||||
unlock_kernel();
|
|
||||||
kfree(uref_multi);
|
kfree(uref_multi);
|
||||||
return i;
|
return i;
|
||||||
case HIDIOCGUSAGES:
|
case HIDIOCGUSAGES:
|
||||||
|
@ -547,15 +545,12 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
goodreturn:
|
goodreturn:
|
||||||
unlock_kernel();
|
|
||||||
kfree(uref_multi);
|
kfree(uref_multi);
|
||||||
return 0;
|
return 0;
|
||||||
fault:
|
fault:
|
||||||
unlock_kernel();
|
|
||||||
kfree(uref_multi);
|
kfree(uref_multi);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
inval:
|
inval:
|
||||||
unlock_kernel();
|
|
||||||
kfree(uref_multi);
|
kfree(uref_multi);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue