mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
tty: Handle problem if line discipline does not have receive_buf
commit 27cfb3a53b
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>
This commit is contained in:
parent
dff6b7b31d
commit
0609c03246
1 changed files with 2 additions and 1 deletions
|
@ -2324,7 +2324,8 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
|
|||
ld = tty_ldisc_ref_wait(tty);
|
||||
if (!ld)
|
||||
return -EIO;
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue