summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorVicki Pfau <vi@endrift.com>2023-11-30 16:10:45 -0800
committerVicki Pfau <vi@endrift.com>2023-11-30 17:33:22 -0800
commit37726e4f7e877e3ee25d1eaf50b161ce1ff06801 (patch)
treeeda82eb6d741180068eaffc3664f0b5bd236c6dd /drivers
parent4a9a68a2d2ceeebc5c5393ddbf8caa5ac2fdbecd (diff)
downloadlinux-37726e4f7e877e3ee25d1eaf50b161ce1ff06801.tar.gz
uinput: Allow uinput_request_submit wait interrupting
Currently, uinput_request_submit will only fail if the request wait times out.
However, in other places this wait is interruptable, and in this specific
location it can lead to issues, such as causing system suspend to hang until
the request times out. Since the timeout is so long, this can cause the
appearance of a total system freeze. Making the wait interruptable resolves
this and possibly further issues.

Signed-off-by: Vicki Pfau <vi@endrift.com>
(cherry picked from commit 15ca4637d3a9b38fe154555999d7f87fd73a0b2f)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/misc/uinput.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index f2593133e524..526e8765afcb 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -182,7 +182,11 @@ static int uinput_request_submit(struct uinput_device *udev,
 	if (retval)
 		goto out;
 
-	if (!wait_for_completion_timeout(&request->done, 30 * HZ)) {
+	retval = wait_for_completion_interruptible_timeout(&request->done, 30 * HZ);
+	if (retval == -ERESTARTSYS)
+		goto out;
+
+	if (!retval) {
 		retval = -ETIMEDOUT;
 		goto out;
 	}