Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ed1cfb

Browse files
sthibaulgregkh
authored andcommitted
speakup ttyio: Do not schedule() in ttyio_in_nowait
With the ltlk and spkout drivers, the index read function, i.e.in_nowait, is getting called from the read_all_doc mechanism, fromthe timer softirq:Call Trace: <IRQ> dump_stack+0x71/0x98 dequeue_task_idle+0x1f/0x28 __schedule+0x167/0x5d6 ? trace_hardirqs_on+0x2e/0x3a ? usleep_range+0x7f/0x7f schedule+0x8a/0xae schedule_timeout+0xb1/0xea ? del_timer_sync+0x31/0x31 do_wait_for_common+0xba/0x12b ? wake_up_q+0x45/0x45 wait_for_common+0x37/0x50 ttyio_in+0x2a/0x6b spk_ttyio_in_nowait+0xc/0x13 spk_get_index_count+0x20/0x93 cursor_done+0x1c6/0x4c6 ? read_all_doc+0xb1/0xb1 call_timer_fn+0x89/0x140 run_timer_softirq+0x164/0x1a5 ? read_all_doc+0xb1/0xb1 ? hrtimer_forward+0x7b/0x87 ? timerqueue_add+0x62/0x68 ? enqueue_hrtimer+0x95/0x9f __do_softirq+0x181/0x31f irq_exit+0x6a/0x86smp_apic_timer_interrupt+0x15e/0x183 apic_timer_interrupt+0xf/0x20 </IRQ>We thus should not schedule() at all, even with timeout == 0, thiscrashes the kernel. We can however use try_wait_for_completion()instead of wait_for_completion_timeout(0).Cc: stable@vger.kernel.orgReported-by: John Covici <covici@ccs.covici.com>Tested-by: John Covici <covici@ccs.covici.com>Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>Link:https://lore.kernel.org/r/20201108131233.tadycr73sxlvodgo@functionSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent640969a commit3ed1cfb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎drivers/accessibility/speakup/spk_ttyio.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ static unsigned char ttyio_in(int timeout)
298298
structspk_ldisc_data*ldisc_data=speakup_tty->disc_data;
299299
charrv;
300300

301-
if (wait_for_completion_timeout(&ldisc_data->completion,
301+
if (!timeout) {
302+
if (!try_wait_for_completion(&ldisc_data->completion))
303+
return0xff;
304+
}elseif (wait_for_completion_timeout(&ldisc_data->completion,
302305
usecs_to_jiffies(timeout))==0) {
303-
if (timeout)
304-
pr_warn("spk_ttyio: timeout (%d) while waiting for input\n",
305-
timeout);
306+
pr_warn("spk_ttyio: timeout (%d) while waiting for input\n",
307+
timeout);
306308
return0xff;
307309
}
308310

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp