Commit a1960e0f authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

staging: speakup: fix tty-operation NULL derefs

The send_xchar() and tiocmset() tty operations are optional. Add the
missing sanity checks to prevent user-space triggerable NULL-pointer
dereferences.

Fixes: 6b9ad1c7 ("staging: speakup: add send_xchar, tiocmset and input functionality for tty")
Cc: stable <stable@vger.kernel.org>     # 4.13
Cc: Okash Khawaja <okash.khawaja@gmail.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d95987a
......@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
return;
}
speakup_tty->ops->send_xchar(speakup_tty, ch);
if (speakup_tty->ops->send_xchar)
speakup_tty->ops->send_xchar(speakup_tty, ch);
mutex_unlock(&speakup_tty_mutex);
}
......@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
return;
}
speakup_tty->ops->tiocmset(speakup_tty, set, clear);
if (speakup_tty->ops->tiocmset)
speakup_tty->ops->tiocmset(speakup_tty, set, clear);
mutex_unlock(&speakup_tty_mutex);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment