diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-10-13 00:05:53 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-10-13 00:13:11 -0400 |
commit | 05be8b81aafd4f95106a91ff3fd8581fa984fad9 (patch) | |
tree | d34da61ab5fa18f5fb57b0342a1e3871aedb36bc /include/linux/uinput.h | |
parent | 341deefe8f4584b09564193cb46d8cf386f491a5 (diff) |
Input: force feedback - potential integer wrap in input_ff_create()
The problem here is that max_effects can wrap on 32 bits systems.
We'd allocate a smaller amount of data than sizeof(struct ff_device).
The call to kcalloc() on the next line would fail but it would write
the NULL return outside of the memory we just allocated causing data
corruption.
The call path is that uinput_setup_device() get ->ff_effects_max from
the user and sets the value in the ->private_data struct. From there
it is:
-> uinput_ioctl_handler()
-> uinput_create_device()
-> input_ff_create(dev, udev->ff_effects_max);
I've also changed ff_effects_max so it's an unsigned int instead of
a signed int as a cleanup.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/uinput.h')
-rw-r--r-- | include/linux/uinput.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/uinput.h b/include/linux/uinput.h index d28c726ede4f..2aa2881b0df9 100644 --- a/include/linux/uinput.h +++ b/include/linux/uinput.h | |||
@@ -68,7 +68,7 @@ struct uinput_device { | |||
68 | unsigned char head; | 68 | unsigned char head; |
69 | unsigned char tail; | 69 | unsigned char tail; |
70 | struct input_event buff[UINPUT_BUFFER_SIZE]; | 70 | struct input_event buff[UINPUT_BUFFER_SIZE]; |
71 | int ff_effects_max; | 71 | unsigned int ff_effects_max; |
72 | 72 | ||
73 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; | 73 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; |
74 | wait_queue_head_t requests_waitq; | 74 | wait_queue_head_t requests_waitq; |