This is a note to let you know that I've just added the patch titled tty: fix up hung_up_tty_read() conversion to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tty-fix-up-hung_up_tty_read-conversion.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ddc5fda7456178e2cbc87675b370920d98360daf Mon Sep 17 00:00:00 2001 From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 21 Jan 2021 10:08:15 -0800 Subject: tty: fix up hung_up_tty_read() conversion From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> commit ddc5fda7456178e2cbc87675b370920d98360daf upstream. In commit "tty: implement read_iter", I left the read_iter conversion of the hung up tty case alone, because I incorrectly thought it didn't matter. Jiri showed me the errors of my ways, and pointed out the problems with that incomplete conversion. Fix it all up. Reported-by: Jiri Slaby <jirislaby@xxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx> Link: https://lore.kernel.org/r/CAHk-=wh+-rGsa=xruEWdg_fJViFG8rN9bpLrfLz=_yBYh2tBhA@xxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/tty/tty_io.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -429,8 +429,7 @@ struct tty_driver *tty_find_polling_driv EXPORT_SYMBOL_GPL(tty_find_polling_driver); #endif -static ssize_t hung_up_tty_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) +static ssize_t hung_up_tty_read(struct kiocb *iocb, struct iov_iter *to) { return 0; } @@ -502,7 +501,7 @@ static const struct file_operations cons static const struct file_operations hung_up_tty_fops = { .llseek = no_llseek, - .read = hung_up_tty_read, + .read_iter = hung_up_tty_read, .write_iter = hung_up_tty_write, .poll = hung_up_tty_poll, .unlocked_ioctl = hung_up_tty_ioctl, @@ -928,8 +927,10 @@ static ssize_t tty_read(struct kiocb *io /* 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(iocb, to); i = -EIO; - if (ld && ld->ops->read) + if (ld->ops->read) i = iterate_tty_read(ld, tty, file, to); tty_ldisc_deref(ld); Patches currently in stable-queue which might be from torvalds@xxxxxxxxxxxxxxxxxxxx are queue-5.11/tty-teach-the-n_tty-icanon-case-about-the-new-cookie-continuations-too.patch queue-5.11/tty-teach-n_tty-line-discipline-about-the-new-cookie-continuations.patch queue-5.11/tty-clean-up-legacy-leftovers-from-n_tty-line-discipline.patch queue-5.11/tty-fix-up-iterate_tty_read-eoverflow-handling.patch queue-5.11/mm-hugetlb.c-fix-unnecessary-address-expansion-of-pmd-sharing.patch queue-5.11/tty-fix-up-hung_up_tty_read-conversion.patch