Commit ceeeb880 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Stefan Bader

tty: Handle problem if line discipline does not have receive_buf

BugLink: https://bugs.launchpad.net/bugs/1818803

commit 27cfb3a5 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: default avatarJann Horn <jannh@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent bee0e9b5
...@@ -2326,6 +2326,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p) ...@@ -2326,6 +2326,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
ld = tty_ldisc_ref_wait(tty); ld = tty_ldisc_ref_wait(tty);
if (!ld) if (!ld)
return -EIO; return -EIO;
if (ld->ops->receive_buf)
ld->ops->receive_buf(tty, &ch, &mbz, 1); ld->ops->receive_buf(tty, &ch, &mbz, 1);
tty_ldisc_deref(ld); tty_ldisc_deref(ld);
return 0; return 0;
......
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