From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
To: torvalds@linux-foundation.org
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
linux-kernel@vger.kernel.org,
syzbot+3d2c27c2b7dc2a94814d@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk
Subject: Re: WARNING in iov_iter_revert (2)
Date: Sun, 21 Feb 2021 14:37:05 +0600 [thread overview]
Message-ID: <20210221083705.3075978-1-snovitoll@gmail.com> (raw)
In-Reply-To: <CAHk-=wgJuiASyuFSBR9GgN2iPSL7Ep7G_GR1kKsGTL=qhDTDUg@mail.gmail.com>
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -961,6 +961,9 @@ static inline ssize_t do_tty_write(
> ret = write(tty, file, tty->write_buf, size);
> if (ret <= 0)
> break;
> + /* ttyprintk historical oddity */
> + if (ret > size)
> + break;
>
> /* FIXME! Have Al check this! */
> if (ret != size)
>
> in there. Because right now we clearly do strange and not-so-wonderful
> things if the write routine returns a bigger value than it was
> passed.. Not limited to that iov_iter_revert() thing, but the whole
> loop.
>
> Comments?
Just want to comment that this fix is correct (tested),
rather than what I did [1] to return abruptly
in the beginning of do_tty_write() for write(fd, NULL, 0) case.
Let me know if I can prepare a patch with Linus's fix above.
[1] https://lore.kernel.org/lkml/20210217155536.2986178-1-snovitoll@gmail.com
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -905,6 +905,9 @@ static inline ssize_t do_tty_write(
ssize_t ret, written = 0;
unsigned int chunk;
+ if (!count)
+ return -EFAULT;
+
ret = tty_write_lock(tty, file->f_flags & O_NDELAY);
if (ret < 0)
return ret;
next prev parent reply other threads:[~2021-02-21 8:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-16 16:18 WARNING in iov_iter_revert (2) syzbot
2021-02-20 14:25 ` syzbot
[not found] ` <CAHk-=wiEBTD884i-U9DU7aDdRxXuz66Q1r-rKTiJUzZoYFgp+g@mail.gmail.com>
2021-02-20 17:38 ` Al Viro
2021-02-20 17:40 ` [git pull] work.namei stuff (v2) Al Viro
2021-02-21 17:43 ` Linus Torvalds
2021-02-21 18:39 ` pr-tracker-bot
2021-02-20 19:29 ` WARNING in iov_iter_revert (2) Al Viro
2021-02-20 19:40 ` Al Viro
2021-02-21 0:45 ` Linus Torvalds
2021-02-21 8:37 ` Sabyrzhan Tasbolatov [this message]
2021-02-21 17:20 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210221083705.3075978-1-snovitoll@gmail.com \
--to=snovitoll@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+3d2c27c2b7dc2a94814d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.