[lkml]   [2021]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: WARNING in iov_iter_revert (2)
[ Let's see how long this lasts, but I've got a generator for the
laptop, and hopefully I'll be able to start doing pulls tonight, and
get "real" power tomorrow ]

On Sat, Feb 20, 2021 at 11:30 AM Al Viro <> wrote:
> IOW, it's not iov_iter_revert() being weird or do_tty_write() misuing it -
> it's tpk_write() playing silly buggers.

Ok, that's actually not as bad I was was afraid it might be.

> Do we want to preserve that weirdness of /dev/ttyprintk writes?
> That's orthogonal to the iov_iter uses in there.

I don't think the ttyprintk weirdness was intentional. I'd fix that,
but in the meantime clearly we should make do_tty_write() protect
against this insanity, and do something like

--- 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)
+ /* 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



 \ /
  Last update: 2021-02-21 01:48    [W:0.065 / U:5.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site