Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: uinput - don't use "interruptible" in FF code

If thread that submitted FF request gets interrupted somehow it
will release request structure and ioctl handler will work with
freed memory. TO prevent that from happening switch to using
wait_for_completion instead of wait_for_completion_interruptible.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

+3 -8
+3 -8
drivers/input/misc/uinput.c
··· 92 92 { 93 93 /* Mark slot as available */ 94 94 udev->requests[request->id] = NULL; 95 - wake_up_interruptible(&udev->requests_waitq); 95 + wake_up(&udev->requests_waitq); 96 96 97 97 complete(&request->done); 98 98 } 99 99 100 100 static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) 101 101 { 102 - int retval; 103 - 104 102 /* Tell our userspace app about this new request by queueing an input event */ 105 103 uinput_dev_event(dev, EV_UINPUT, request->code, request->id); 106 104 107 105 /* Wait for the request to complete */ 108 - retval = wait_for_completion_interruptible(&request->done); 109 - if (!retval) 110 - retval = request->retval; 111 - 112 - return retval; 106 + wait_for_completion(&request->done); 107 + return request->retval; 113 108 } 114 109 115 110 static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)