aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-20 04:46:58 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-21 11:41:02 -0500
commit27cfb3a53be46a54ec5e0bd04e51995b74c90343 (patch)
tree04163f2cb58466c7620882f449e0af71ff100bae /drivers/tty/tty_io.c
parentbfd8d8fe98b8792f362cd210a7873969f8d2fc04 (diff)
tty: Handle problem if line discipline does not have receive_buf
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/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 23c6fd238422..21ffcce16927 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2189,7 +2189,8 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
2189 ld = tty_ldisc_ref_wait(tty); 2189 ld = tty_ldisc_ref_wait(tty);
2190 if (!ld) 2190 if (!ld)
2191 return -EIO; 2191 return -EIO;
2192 ld->ops->receive_buf(tty, &ch, &mbz, 1); 2192 if (ld->ops->receive_buf)
2193 ld->ops->receive_buf(tty, &ch, &mbz, 1);
2193 tty_ldisc_deref(ld); 2194 tty_ldisc_deref(ld);
2194 return 0; 2195 return 0;
2195} 2196}