]> git.baikalelectronics.ru Git - kernel.git/commit
tty: protect tty_write from odd low-level tty disciplines
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 21 Feb 2021 05:15:00 +0000 (21:15 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 21 Feb 2021 05:15:00 +0000 (21:15 -0800)
commit59c187e6ada6d019737558691466ac3f8d6f36fe
treea767eb2e72cc0b154e33cdcc01dd7459eea47181
parentfe68741e12c7968cd370656394d12ebfcade408b
tty: protect tty_write from odd low-level tty disciplines

Al root-caused a new warning from syzbot to the ttyprintk tty driver
returning a write count larger than the data the tty layer actually gave
it.  Which confused the tty write code mightily, and with the new
iov_iter based code, caused a WARNING in iov_iter_revert().

syzbot correctly bisected the source of the new warning to commit
0bae1a191e82 ("tty: implement write_iter"), but the oddity goes back
much further, it just didn't get caught by anything before.

Reported-by: syzbot+3d2c27c2b7dc2a94814d@syzkaller.appspotmail.com
Fixes: 0bae1a191e82 ("tty: implement write_iter")
Debugged-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/tty/tty_io.c