Messages in this thread | | | Subject | Re: [PATCH 3/6] tty: implement read_iter | From | Jiri Slaby <> | Date | Thu, 21 Jan 2021 11:44:57 +0100 |
| |
On 21. 01. 21, 10:00, Greg Kroah-Hartman wrote: > From: Linus Torvalds <torvalds@linux-foundation.org> > > Now that the ldisc read() function takes kernel pointers, it's fairly > straightforward to make the tty file operations use .read_iter() instead > of .read(). > > That automatically gives us vread() and friends, and also makes it > possible to do .splice_read() on ttys again. > > Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops") > Reported-by: Oliver Giles <ohw.giles@gmail.com> > Cc: Christoph Hellwig <hch@lst.de> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Al Viro <viro@zeniv.linux.org.uk> > Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> > --- > drivers/tty/tty_io.c | 36 ++++++++++++++++++------------------ > 1 file changed, 18 insertions(+), 18 deletions(-) > > diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c > index a34f8bcf875e..8846d3b99845 100644 > --- a/drivers/tty/tty_io.c > +++ b/drivers/tty/tty_io.c ... > @@ -907,10 +909,10 @@ static int iterate_tty_read(struct tty_ldisc *ld, struct tty_struct *tty, struct > * read calls may be outstanding in parallel. > */ > > -static ssize_t tty_read(struct file *file, char __user *buf, size_t count, > - loff_t *ppos) > +static ssize_t tty_read(struct kiocb *iocb, struct iov_iter *to) > { > int i; > + struct file *file = iocb->ki_filp; > struct inode *inode = file_inode(file); > struct tty_struct *tty = file_tty(file); > struct tty_ldisc *ld; > @@ -923,11 +925,9 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count, > /* We want to wait for the line discipline to sort out in this > situation */ > ld = tty_ldisc_ref_wait(tty); > - if (!ld) > - return hung_up_tty_read(file, buf, count, ppos); > i = -EIO; > - if (ld->ops->read) > - i = iterate_tty_read(ld, tty, file, buf, count); > + if (ld && ld->ops->read) > + i = iterate_tty_read(ld, tty, file, to); > tty_ldisc_deref(ld);
Here we have the same problem as in tty_write.
And also the other one with hung_up_tty_read not converted.
thanks, -- js
| |