From: Jiri Slaby <jirislaby@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org
Cc: hch@lst.de, viro@zeniv.linux.org.uk,
linux-kernel@vger.kernel.org, ohw.giles@gmail.com,
r.karszniewicz@phytec.de,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3/6] tty: implement read_iter
Date: Thu, 21 Jan 2021 11:44:57 +0100 [thread overview]
Message-ID: <72c5fa0a-b0e2-740a-54d1-07e806a53024@kernel.org> (raw)
In-Reply-To: <20210121090020.3147058-3-gregkh@linuxfoundation.org>
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
next prev parent reply other threads:[~2021-01-21 10:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 9:00 [PATCH 1/6] tty: implement write_iter Greg Kroah-Hartman
2021-01-21 9:00 ` [PATCH 2/6] tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer Greg Kroah-Hartman
2021-01-21 11:02 ` Jiri Slaby
2021-01-21 17:46 ` Linus Torvalds
2021-01-21 17:57 ` Greg Kroah-Hartman
2021-01-21 9:00 ` [PATCH 3/6] tty: implement read_iter Greg Kroah-Hartman
2021-01-21 10:44 ` Jiri Slaby [this message]
2021-01-21 9:00 ` [PATCH 4/6] tty: clean up legacy leftovers from n_tty line discipline Greg Kroah-Hartman
2021-01-21 9:00 ` [PATCH 5/6] tty: teach n_tty line discipline about the new "cookie continuations" Greg Kroah-Hartman
2021-01-21 9:00 ` [PATCH 6/6] tty: teach the n_tty ICANON case about the new "cookie continuations" too Greg Kroah-Hartman
2021-01-21 9:39 ` [PATCH 1/6] tty: implement write_iter Jiri Slaby
2021-01-21 17:44 ` Linus Torvalds
2021-01-21 17:57 ` Greg Kroah-Hartman
2021-01-21 18:42 ` Linus Torvalds
2021-01-21 19:43 ` Greg Kroah-Hartman
2021-01-21 21:09 ` Linus Torvalds
2021-01-22 7:07 ` Jiri Slaby
2021-01-22 7:33 ` Jiri Slaby
2021-01-22 7:43 ` Greg Kroah-Hartman
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=72c5fa0a-b0e2-740a-54d1-07e806a53024@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=ohw.giles@gmail.com \
--cc=r.karszniewicz@phytec.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®