• Okash Khawaja's avatar
    staging: speakup: fix async usb removal · f5bee24d
    Okash Khawaja authored
    When an external USB synth is unplugged while the module is loaded, we
    get a null pointer deref. This is because the tty disappears while
    speakup tries to use to to communicate with the synth. This patch fixes
    it by checking tty for null before using it. Since tty can become null
    between the check and its usage, a mutex is introduced. tty usage is
    now surrounded by the mutex, as is the code in speakup_ldisc_close which
    sets the tty to null. The mutex also serialises calls to tty from
    speakup code.
    
    In case of tty being null, this sets synth->alive to zero and restarts
    ttys in case they were stopped by speakup.
    Signed-off-by: default avatarOkash Khawaja <okash.khawaja@gmail.com>
    Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f5bee24d
spk_ttyio.c 8.12 KB