Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27cfb3a5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarJann Horn <jannh@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfd8d8fe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2189,6 +2189,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
	ld = tty_ldisc_ref_wait(tty);
	if (!ld)
		return -EIO;
	if (ld->ops->receive_buf)
		ld->ops->receive_buf(tty, &ch, &mbz, 1);
	tty_ldisc_deref(ld);
	return 0;