Re: tty splice branch (was "Re: Splicing to/from a tty")

From: Greg Kroah-Hartman
Date: Thu Jan 21 2021 - 04:00:04 EST


On Thu, Jan 21, 2021 at 09:50:39AM +0100, Jiri Slaby wrote:
> On 21. 01. 21, 2:18, Linus Torvalds wrote:
> > On Tue, Jan 19, 2021 at 8:44 PM Linus Torvalds
> > <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > I'll come back to this tomorrow and do the line-buffered icanon case
> > > too (unless pull requests pile up), and then I'll be happy with the
> > > tty changes, and I think I can submit this series for real to Greg.
> >
> > Greg, I don't know how you want to handle this.
> >
> > I have a branch with my tty splice patches at
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git tty-splice
> >
> > and that now includes doing that "cookie continuation" thing even for
> > the N_TTY icanon modes.
> >
> > It passes my local tests, and I did try a few rather odd things. And
> > Oliver tested an ealier version without that final commit on his load.
> > But...
>
> Hm, I would like to review this first. I noticed the changes only because a
> new branch appeared when I grabbed your tree and the branch has "tty" in its
> name.
>
> So for example:
>
> > @@ -1038,18 +1045,15 @@ static ssize_t tty_write(struct file *file, const char __user *buf,
> > if (tty->ops->write_room == NULL)
> > tty_err(tty, "missing write_room method\n");
> > ld = tty_ldisc_ref_wait(tty);
> > - if (!ld)
> > - return hung_up_tty_write(file, buf, count, ppos);
> > - if (!ld->ops->write)
> > + if (!ld || !ld->ops->write)
> > ret = -EIO;
> > else
> > - ret = do_tty_write(ld->ops->write, tty, file, buf, count);
> > + ret = do_tty_write(ld->ops->write, tty, file, from);
> > tty_ldisc_deref(ld);
>
> if ld == NULL => crash here.
>
> So can you send the patches to the list and Cc me too?

I'll send them out right now, I've already merged them to my branches.

greg k-h