Input: uinput - add a schedule point in uinput_inject_events()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 5 Oct 2018 00:50:48 +0000 (17:50 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 5 Oct 2018 18:42:32 +0000 (11:42 -0700)
Large writes to uinput interface may cause rcu stalls. Let's add
cond_resched() to the loop to avoid this.

Reviewed-by: Paul E. McKenney <paulmck@linux.ibm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/uinput.c

index eb14ddf693467b4619a9501aa5e712a9b45dfcdf..8ec483e8688be194078d07f3b47fa40d7f75e9ac 100644 (file)
@@ -598,6 +598,7 @@ static ssize_t uinput_inject_events(struct uinput_device *udev,
 
                input_event(udev->dev, ev.type, ev.code, ev.value);
                bytes += input_event_size();
+               cond_resched();
        }
 
        return bytes;