From: Eric Dumazet edumazet@google.com
[ Upstream commit f74c371fe72a4f820d287db8067683fb533e4ede ]
syzbot was able to trigger rcu stalls by calling write() with large number of bytes.
Add a cond_resched() in the loop to avoid this.
Link: https://lkml.org/lkml/2018/8/23/1106 Signed-off-by: Eric Dumazet edumazet@google.com Reported-by: syzbot+9436b02171ac0894d33e@syzkaller.appspotmail.com Reviewed-by: Paul E. McKenney paulmck@linux.ibm.com Signed-off-by: Dmitry Torokhov dmitry.torokhov@gmail.com Signed-off-by: Sasha Levin sashal@kernel.org --- drivers/input/mousedev.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index b604564dec5c..036acf861496 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -701,6 +701,7 @@ static ssize_t mousedev_write(struct file *file, const char __user *buffer, mousedev_generate_response(client, c);
spin_unlock_irq(&client->packet_lock); + cond_resched(); }
kill_fasync(&client->fasync, SIGIO, POLL_IN);
From: Dmitry Torokhov dmitry.torokhov@gmail.com
[ Upstream commit 36d2582ff235b4e01ad64a734c877a52dc762d9c ]
Large writes to evdev 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 Signed-off-by: Sasha Levin sashal@kernel.org --- drivers/input/evdev.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 928dec311c2b..6e054aae1f50 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -450,6 +450,7 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer,
input_inject_event(&evdev->handle, event.type, event.code, event.value); + cond_resched(); }
out:
From: Dmitry Torokhov dmitry.torokhov@gmail.com
[ Upstream commit cecf10704899467a787975e3d94a1f0129b9688e ]
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 Signed-off-by: Sasha Levin sashal@kernel.org --- drivers/input/misc/uinput.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 5221450f9b57..0cc05a4cf685 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -456,6 +456,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;
From: Khazhismel Kumykov khazhy@google.com
[ Upstream commit ac081c3be3fae6d0cc3e1862507fca3862d30b67 ]
On non-preempt kernels this loop can take a long time (more than 50 ticks) processing through entries.
Link: http://lkml.kernel.org/r/20181010172623.57033-1-khazhy@google.com Signed-off-by: Khazhismel Kumykov khazhy@google.com Acked-by: OGAWA Hirofumi hirofumi@mail.parknet.co.jp Reviewed-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org Signed-off-by: Sasha Levin sashal@kernel.org --- fs/fat/fatent.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 08b3db146888..83550ac31f49 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c @@ -684,6 +684,7 @@ int fat_count_free_clusters(struct super_block *sb) if (ops->ent_get(&fatent) == FAT_ENT_FREE) free++; } while (fat_ent_next(sbi, &fatent)); + cond_resched(); } sbi->free_clusters = free; sbi->free_clus_valid = 1;
linux-stable-mirror@lists.linaro.org