diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-20 10:46:58 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-06 17:34:51 +0100 |
commit | ccf4ecf43373d5e56943cbc3cf725bd02036b4da (patch) | |
tree | 5349e0220400c6931c148de10ed6fb5d34d8440d /drivers/tty | |
parent | bf9702a73e24e99050f5428059b7255043f51086 (diff) | |
download | linux-stable-ccf4ecf43373d5e56943cbc3cf725bd02036b4da.tar.gz linux-stable-ccf4ecf43373d5e56943cbc3cf725bd02036b4da.tar.bz2 linux-stable-ccf4ecf43373d5e56943cbc3cf725bd02036b4da.zip |
tty: Handle problem if line discipline does not have receive_buf
commit 27cfb3a53be46a54ec5e0bd04e51995b74c90343 upstream.
Some tty line disciplines do not have a receive buf callback, so
properly check for that before calling it. If they do not have this
callback, just eat the character quietly, as we can't fail this call.
Reported-by: Jann Horn <jannh@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/tty_io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 73c813939487..33e81b7e2a5a 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2243,7 +2243,8 @@ static int tiocsti(struct tty_struct *tty, char __user *p) return -EFAULT; tty_audit_tiocsti(tty, ch); ld = tty_ldisc_ref_wait(tty); - ld->ops->receive_buf(tty, &ch, &mbz, 1); + if (ld->ops->receive_buf) + ld->ops->receive_buf(tty, &ch, &mbz, 1); tty_ldisc_deref(ld); return 0; } |