Commit 97a192cc authored by Linus Torvalds's avatar Linus Torvalds Committed by Zheng Zengkai
Browse files

tty: protect tty_write from odd low-level tty disciplines



stable inclusion
from stable-5.10.18
commit ffec7ee21809c9c284042875b8d76b0d70a42585
bugzilla: 50148

--------------------------------

commit 3342ff26 upstream.

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
9bb48c82 ("tty: implement write_iter"), but the oddity goes back
much further, it just didn't get caught by anything before.

Reported-by: default avatar <syzbot+3d2c27c2b7dc2a94814d@syzkaller.appspotmail.com>
Fixes: 9bb48c82 ("tty: implement write_iter")
Debugged-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent d3f92988
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment