Skip to content

Commit a1960e0

Browse files
jhovoldgregkh
authored andcommitted
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: 6b9ad1c ("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: Johan Hovold <johan@kernel.org> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4d95987 commit a1960e0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/staging/speakup/spk_ttyio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
265265
return;
266266
}
267267

268-
speakup_tty->ops->send_xchar(speakup_tty, ch);
268+
if (speakup_tty->ops->send_xchar)
269+
speakup_tty->ops->send_xchar(speakup_tty, ch);
269270
mutex_unlock(&speakup_tty_mutex);
270271
}
271272

@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
277278
return;
278279
}
279280

280-
speakup_tty->ops->tiocmset(speakup_tty, set, clear);
281+
if (speakup_tty->ops->tiocmset)
282+
speakup_tty->ops->tiocmset(speakup_tty, set, clear);
281283
mutex_unlock(&speakup_tty_mutex);
282284
}
283285

0 commit comments

Comments
 (0)