]> git.baikalelectronics.ru Git - kernel.git/commit
Input: uinput - sanity check on ff_effects_max and EV_FF
authorElias Vanderstuyft <elias.vds@gmail.com>
Sat, 19 Dec 2015 01:32:19 +0000 (17:32 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 19 Dec 2015 01:48:52 +0000 (17:48 -0800)
commit00fe3a52e6c21906474b95e4009cc47859666c18
treecfc0ce649b7a874b3964efc55b44c6c45d38b77c
parenta681da2787d08196eb9325deffc61e6158206c6d
Input: uinput - sanity check on ff_effects_max and EV_FF

Currently the user can set ff_effects_max to zero with the EV_FF bit (and
the FF_GAIN and/or FF_AUTOCENTER bits) set, in this case the uninitialized
methods ff->set_gain and/or ff->set_autocenter can be dereferenced,
resulting in a kernel oops.

Check in uinput_create_device() and print a helpful message and return
-EINVAL in case the check fails.

Signed-off-by: Elias Vanderstuyft <elias.vds@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/uinput.c