WSL2-Linux-Kernel/drivers/accessibility/speakup
Samuel Thibault 3ed1cfb2ce 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, from
the 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/0x86
smp_apic_timer_interrupt+0x15e/0x183
 apic_timer_interrupt+0xf/0x20
 </IRQ>

We thus should not schedule() at all, even with timeout == 0, this
crashes the kernel.  We can however use try_wait_for_completion()
instead of wait_for_completion_timeout(0).

Cc: stable@vger.kernel.org
Reported-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@function
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-09 18:14:29 +01:00
..
DefaultKeyAssignments
Kconfig speakup: only build serialio when ISA is enabled 2020-08-18 13:15:34 +02:00
Makefile speakup: only build serialio when ISA is enabled 2020-08-18 13:15:34 +02:00
TODO
buffers.c
devsynth.c
fakekey.c
i18n.c
i18n.h
keyhelp.c
kobjects.c
main.c speakup: Fix clearing selection in safe context 2020-11-09 18:14:20 +01:00
selection.c speakup: Fix clearing selection in safe context 2020-11-09 18:14:20 +01:00
serialio.c speakup: Fix wait_for_xmitr for ttyio case 2020-08-18 13:15:32 +02:00
serialio.h
speakup.h speakup: Fix clearing selection in safe context 2020-11-09 18:14:20 +01:00
speakup_acnt.h
speakup_acntpc.c
speakup_acntsa.c
speakup_apollo.c
speakup_audptr.c
speakup_bns.c
speakup_decext.c
speakup_decpc.c
speakup_dectlk.c
speakup_dtlk.c
speakup_dtlk.h
speakup_dummy.c
speakup_keypc.c
speakup_ltlk.c
speakup_soft.c
speakup_spkout.c
speakup_txprt.c
speakupmap.h
speakupmap.map
spk_priv.h speakup: Fix wait_for_xmitr for ttyio case 2020-08-18 13:15:32 +02:00
spk_priv_keyinfo.h
spk_ttyio.c speakup ttyio: Do not schedule() in ttyio_in_nowait 2020-11-09 18:14:29 +01:00
spk_types.h speakup: Fix var_id_t values and thus keymap 2020-11-09 18:13:49 +01:00
synth.c speakup: Fix wait_for_xmitr for ttyio case 2020-08-18 13:15:32 +02:00
thread.c
varhandlers.c