]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Feb 2022 06:29:49 +0000 (07:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Feb 2022 06:29:49 +0000 (07:29 +0100)
added patches:
asoc-tas2770-insert-post-reset-delay.patch
block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
mtd-rawnand-brcmnand-fixed-incorrect-sub-page-ecc-status.patch
mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch
nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
nfs-lookup_directory-is-also-ok-with-symlinks.patch
tty-n_tty-do-not-look-ahead-for-eol-character-past-the-end-of-the-buffer.patch

queue-5.10/asoc-tas2770-insert-post-reset-delay.patch [new file with mode: 0644]
queue-5.10/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch [new file with mode: 0644]
queue-5.10/mtd-rawnand-brcmnand-fixed-incorrect-sub-page-ecc-status.patch [new file with mode: 0644]
queue-5.10/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch [new file with mode: 0644]
queue-5.10/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch [new file with mode: 0644]
queue-5.10/nfs-lookup_directory-is-also-ok-with-symlinks.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/tty-n_tty-do-not-look-ahead-for-eol-character-past-the-end-of-the-buffer.patch [new file with mode: 0644]

diff --git a/queue-5.10/asoc-tas2770-insert-post-reset-delay.patch b/queue-5.10/asoc-tas2770-insert-post-reset-delay.patch
new file mode 100644 (file)
index 0000000..56823ec
--- /dev/null
@@ -0,0 +1,59 @@
+From 307f31452078792aab94a729fce33200c6e42dc4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Povi=C5=A1er?= <povik+lin@cutebit.org>
+Date: Fri, 4 Feb 2022 10:53:01 +0100
+Subject: ASoC: tas2770: Insert post reset delay
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Martin Povišer <povik+lin@cutebit.org>
+
+commit 307f31452078792aab94a729fce33200c6e42dc4 upstream.
+
+Per TAS2770 datasheet there must be a 1 ms delay from reset to first
+command. So insert delays into the driver where appropriate.
+
+Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
+Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
+Link: https://lore.kernel.org/r/20220204095301.5554-1-povik+lin@cutebit.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/codecs/tas2770.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/tas2770.c
++++ b/sound/soc/codecs/tas2770.c
+@@ -38,10 +38,12 @@ static void tas2770_reset(struct tas2770
+               gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
+               msleep(20);
+               gpiod_set_value_cansleep(tas2770->reset_gpio, 1);
++              usleep_range(1000, 2000);
+       }
+       snd_soc_component_write(tas2770->component, TAS2770_SW_RST,
+               TAS2770_RST);
++      usleep_range(1000, 2000);
+ }
+ static int tas2770_set_bias_level(struct snd_soc_component *component,
+@@ -110,6 +112,7 @@ static int tas2770_codec_resume(struct s
+       if (tas2770->sdz_gpio) {
+               gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
++              usleep_range(1000, 2000);
+       } else {
+               ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
+                                                   TAS2770_PWR_CTRL_MASK,
+@@ -510,8 +513,10 @@ static int tas2770_codec_probe(struct sn
+       tas2770->component = component;
+-      if (tas2770->sdz_gpio)
++      if (tas2770->sdz_gpio) {
+               gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
++              usleep_range(1000, 2000);
++      }
+       tas2770_reset(tas2770);
diff --git a/queue-5.10/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch b/queue-5.10/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
new file mode 100644 (file)
index 0000000..cc29dbd
--- /dev/null
@@ -0,0 +1,78 @@
+From e92bc4cd34de2ce454bdea8cd198b8067ee4e123 Mon Sep 17 00:00:00 2001
+From: Laibin Qiu <qiulaibin@huawei.com>
+Date: Sat, 22 Jan 2022 19:10:45 +0800
+Subject: block/wbt: fix negative inflight counter when remove scsi device
+
+From: Laibin Qiu <qiulaibin@huawei.com>
+
+commit e92bc4cd34de2ce454bdea8cd198b8067ee4e123 upstream.
+
+Now that we disable wbt by set WBT_STATE_OFF_DEFAULT in
+wbt_disable_default() when switch elevator to bfq. And when
+we remove scsi device, wbt will be enabled by wbt_enable_default.
+If it become false positive between wbt_wait() and wbt_track()
+when submit write request.
+
+The following is the scenario that triggered the problem.
+
+T1                          T2                           T3
+                            elevator_switch_mq
+                            bfq_init_queue
+                            wbt_disable_default <= Set
+                            rwb->enable_state (OFF)
+Submit_bio
+blk_mq_make_request
+rq_qos_throttle
+<= rwb->enable_state (OFF)
+                                                         scsi_remove_device
+                                                         sd_remove
+                                                         del_gendisk
+                                                         blk_unregister_queue
+                                                         elv_unregister_queue
+                                                         wbt_enable_default
+                                                         <= Set rwb->enable_state (ON)
+q_qos_track
+<= rwb->enable_state (ON)
+^^^^^^ this request will mark WBT_TRACKED without inflight add and will
+lead to drop rqw->inflight to -1 in wbt_done() which will trigger IO hung.
+
+Fix this by move wbt_enable_default() from elv_unregister to
+bfq_exit_queue(). Only re-enable wbt when bfq exit.
+
+Fixes: 76a8040817b4b ("blk-wbt: make sure throttle is enabled properly")
+
+Remove oneline stale comment, and kill one oneshot local variable.
+
+Signed-off-by: Ming Lei <ming.lei@rehdat.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/linux-block/20211214133103.551813-1-qiulaibin@huawei.com/
+Signed-off-by: Laibin Qiu <qiulaibin@huawei.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/bfq-iosched.c |    2 ++
+ block/elevator.c    |    2 --
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -6404,6 +6404,8 @@ static void bfq_exit_queue(struct elevat
+       spin_unlock_irq(&bfqd->lock);
+ #endif
++      wbt_enable_default(bfqd->queue);
++
+       kfree(bfqd);
+ }
+--- a/block/elevator.c
++++ b/block/elevator.c
+@@ -518,8 +518,6 @@ void elv_unregister_queue(struct request
+               kobject_del(&e->kobj);
+               e->registered = 0;
+-              /* Re-enable throttling in case elevator disabled it */
+-              wbt_enable_default(q);
+       }
+ }
diff --git a/queue-5.10/mtd-rawnand-brcmnand-fixed-incorrect-sub-page-ecc-status.patch b/queue-5.10/mtd-rawnand-brcmnand-fixed-incorrect-sub-page-ecc-status.patch
new file mode 100644 (file)
index 0000000..2ef3744
--- /dev/null
@@ -0,0 +1,43 @@
+From 36415a7964711822e63695ea67fede63979054d9 Mon Sep 17 00:00:00 2001
+From: david regan <dregan@mail.com>
+Date: Wed, 26 Jan 2022 23:43:44 +0100
+Subject: mtd: rawnand: brcmnand: Fixed incorrect sub-page ECC status
+
+From: david regan <dregan@mail.com>
+
+commit 36415a7964711822e63695ea67fede63979054d9 upstream.
+
+The brcmnand driver contains a bug in which if a page (example 2k byte)
+is read from the parallel/ONFI NAND and within that page a subpage (512
+byte) has correctable errors which is followed by a subpage with
+uncorrectable errors, the page read will return the wrong status of
+correctable (as opposed to the actual status of uncorrectable.)
+
+The bug is in function brcmnand_read_by_pio where there is a check for
+uncorrectable bits which will be preempted if a previous status for
+correctable bits is detected.
+
+The fix is to stop checking for bad bits only if we already have a bad
+bits status.
+
+Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
+Signed-off-by: david regan <dregan@mail.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/trinity-478e0c09-9134-40e8-8f8c-31c371225eda-1643237024774@3c-app-mailcom-lxa02
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/brcmnand/brcmnand.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+@@ -2062,7 +2062,7 @@ static int brcmnand_read_by_pio(struct m
+                                       mtd->oobsize / trans,
+                                       host->hwcfg.sector_size_1k);
+-              if (!ret) {
++              if (ret != -EBADMSG) {
+                       *err_addr = brcmnand_get_uncorrecc_addr(ctrl);
+                       if (*err_addr)
diff --git a/queue-5.10/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch b/queue-5.10/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch
new file mode 100644 (file)
index 0000000..f553693
--- /dev/null
@@ -0,0 +1,91 @@
+From 5c23b3f965bc9ee696bf2ed4bdc54d339dd9a455 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 3 Jan 2022 03:03:15 +0000
+Subject: mtd: rawnand: qcom: Fix clock sequencing in qcom_nandc_probe()
+
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+
+commit 5c23b3f965bc9ee696bf2ed4bdc54d339dd9a455 upstream.
+
+Interacting with a NAND chip on an IPQ6018 I found that the qcomsmem NAND
+partition parser was returning -EPROBE_DEFER waiting for the main smem
+driver to load.
+
+This caused the board to reset. Playing about with the probe() function
+shows that the problem lies in the core clock being switched off before the
+nandc_unalloc() routine has completed.
+
+If we look at how qcom_nandc_remove() tears down allocated resources we see
+the expected order is
+
+qcom_nandc_unalloc(nandc);
+
+clk_disable_unprepare(nandc->aon_clk);
+clk_disable_unprepare(nandc->core_clk);
+
+dma_unmap_resource(&pdev->dev, nandc->base_dma, resource_size(res),
+                  DMA_BIDIRECTIONAL, 0);
+
+Tweaking probe() to both bring up and tear-down in that order removes the
+reset if we end up deferring elsewhere.
+
+Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver")
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-2-bryan.odonoghue@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/qcom_nandc.c |   14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+--- a/drivers/mtd/nand/raw/qcom_nandc.c
++++ b/drivers/mtd/nand/raw/qcom_nandc.c
+@@ -2,7 +2,6 @@
+ /*
+  * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+  */
+-
+ #include <linux/clk.h>
+ #include <linux/slab.h>
+ #include <linux/bitops.h>
+@@ -2968,10 +2967,6 @@ static int qcom_nandc_probe(struct platf
+       if (!nandc->base_dma)
+               return -ENXIO;
+-      ret = qcom_nandc_alloc(nandc);
+-      if (ret)
+-              goto err_nandc_alloc;
+-
+       ret = clk_prepare_enable(nandc->core_clk);
+       if (ret)
+               goto err_core_clk;
+@@ -2980,6 +2975,10 @@ static int qcom_nandc_probe(struct platf
+       if (ret)
+               goto err_aon_clk;
++      ret = qcom_nandc_alloc(nandc);
++      if (ret)
++              goto err_nandc_alloc;
++
+       ret = qcom_nandc_setup(nandc);
+       if (ret)
+               goto err_setup;
+@@ -2991,15 +2990,14 @@ static int qcom_nandc_probe(struct platf
+       return 0;
+ err_setup:
++      qcom_nandc_unalloc(nandc);
++err_nandc_alloc:
+       clk_disable_unprepare(nandc->aon_clk);
+ err_aon_clk:
+       clk_disable_unprepare(nandc->core_clk);
+ err_core_clk:
+-      qcom_nandc_unalloc(nandc);
+-err_nandc_alloc:
+       dma_unmap_resource(dev, res->start, resource_size(res),
+                          DMA_BIDIRECTIONAL, 0);
+-
+       return ret;
+ }
diff --git a/queue-5.10/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch b/queue-5.10/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
new file mode 100644 (file)
index 0000000..e3ee09e
--- /dev/null
@@ -0,0 +1,39 @@
+From d19e0183a88306acda07f4a01fedeeffe2a2a06b Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Tue, 15 Feb 2022 18:05:18 -0500
+Subject: NFS: Do not report writeback errors in nfs_getattr()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit d19e0183a88306acda07f4a01fedeeffe2a2a06b upstream.
+
+The result of the writeback, whether it is an ENOSPC or an EIO, or
+anything else, does not inhibit the NFS client from reporting the
+correct file timestamps.
+
+Fixes: 79566ef018f5 ("NFS: Getattr doesn't require data sync semantics")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/inode.c |    9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -807,12 +807,9 @@ int nfs_getattr(const struct path *path,
+       }
+       /* Flush out writes to the server in order to update c/mtime.  */
+-      if ((request_mask & (STATX_CTIME|STATX_MTIME)) &&
+-                      S_ISREG(inode->i_mode)) {
+-              err = filemap_write_and_wait(inode->i_mapping);
+-              if (err)
+-                      goto out;
+-      }
++      if ((request_mask & (STATX_CTIME | STATX_MTIME)) &&
++          S_ISREG(inode->i_mode))
++              filemap_write_and_wait(inode->i_mapping);
+       /*
+        * We may force a getattr if the user cares about atime.
diff --git a/queue-5.10/nfs-lookup_directory-is-also-ok-with-symlinks.patch b/queue-5.10/nfs-lookup_directory-is-also-ok-with-symlinks.patch
new file mode 100644 (file)
index 0000000..6c51a10
--- /dev/null
@@ -0,0 +1,43 @@
+From e0caaf75d443e02e55e146fd75fe2efc8aed5540 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Tue, 8 Feb 2022 13:38:23 -0500
+Subject: NFS: LOOKUP_DIRECTORY is also ok with symlinks
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 upstream.
+
+Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory
+fails) [1], part of Linux since 5.17-rc2, introduced a regression, where
+a symbolic link on an NFS mount to a directory on another NFS does not
+resolve(?) the first time it is accessed:
+
+Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Tested-by: Donald Buczek <buczek@molgen.mpg.de>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/dir.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfs/dir.c
++++ b/fs/nfs/dir.c
+@@ -1780,14 +1780,14 @@ no_open:
+       if (!res) {
+               inode = d_inode(dentry);
+               if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
+-                  !S_ISDIR(inode->i_mode))
++                  !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
+                       res = ERR_PTR(-ENOTDIR);
+               else if (inode && S_ISREG(inode->i_mode))
+                       res = ERR_PTR(-EOPENSTALE);
+       } else if (!IS_ERR(res)) {
+               inode = d_inode(res);
+               if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
+-                  !S_ISDIR(inode->i_mode)) {
++                  !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
+                       dput(res);
+                       res = ERR_PTR(-ENOTDIR);
+               } else if (inode && S_ISREG(inode->i_mode)) {
index 8a2f037857df038d63eb7123386682e8a57fc773..4dfaeb8e2d8f28d869d314f5310ae00fb99bc221 100644 (file)
@@ -77,3 +77,10 @@ mtd-rawnand-gpmi-don-t-leak-pm-reference-in-error-path.patch
 kvm-svm-never-reject-emulation-due-to-smap-errata-for-sev-guests.patch
 tee-export-teedev_open-and-teedev_close_context.patch
 optee-use-driver-internal-tee_context-for-some-rpc.patch
+asoc-tas2770-insert-post-reset-delay.patch
+block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
+nfs-lookup_directory-is-also-ok-with-symlinks.patch
+nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
+tty-n_tty-do-not-look-ahead-for-eol-character-past-the-end-of-the-buffer.patch
+mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch
+mtd-rawnand-brcmnand-fixed-incorrect-sub-page-ecc-status.patch
diff --git a/queue-5.10/tty-n_tty-do-not-look-ahead-for-eol-character-past-the-end-of-the-buffer.patch b/queue-5.10/tty-n_tty-do-not-look-ahead-for-eol-character-past-the-end-of-the-buffer.patch
new file mode 100644 (file)
index 0000000..7f99213
--- /dev/null
@@ -0,0 +1,106 @@
+From 3593030761630e09200072a4bd06468892c27be3 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Tue, 15 Feb 2022 15:28:00 -0800
+Subject: tty: n_tty: do not look ahead for EOL character past the end of the buffer
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 3593030761630e09200072a4bd06468892c27be3 upstream.
+
+Daniel Gibson reports that the n_tty code gets line termination wrong in
+very specific cases:
+
+ "If you feed a line with exactly 64 chars + terminating newline, and
+  directly afterwards (without reading) another line into a pseudo
+  terminal, the the first read() on the other side will return the 64
+  char line *without* terminating newline, and the next read() will
+  return the missing terminating newline AND the complete next line (if
+  it fits in the buffer)"
+
+and bisected the behavior to commit 3b830a9c34d5 ("tty: convert
+tty_ldisc_ops 'read()' function to take a kernel pointer").
+
+Now, digging deeper, it turns out that the behavior isn't exactly new:
+what changed in commit 3b830a9c34d5 was that the tty line discipline
+.read() function is now passed an intermediate kernel buffer rather than
+the final user space buffer.
+
+And that intermediate kernel buffer is 64 bytes in size - thus that
+special case with exactly 64 bytes plus terminating newline.
+
+The same problem did exist before, but historically the boundary was not
+the 64-byte chunk, but the user-supplied buffer size, which is obviously
+generally bigger (and potentially bigger than N_TTY_BUF_SIZE, which
+would hide the issue entirely).
+
+The reason is that the n_tty canon_copy_from_read_buf() code would look
+ahead for the EOL character one byte further than it would actually
+copy.  It would then decide that it had found the terminator, and unmark
+it as an EOL character - which in turn explains why the next read
+wouldn't then be terminated by it.
+
+Now, the reason it did all this in the first place is related to some
+historical and pretty obscure EOF behavior, see commit ac8f3bf8832a
+("n_tty: Fix poll() after buffer-limited eof push read") and commit
+40d5e0905a03 ("n_tty: Fix EOF push handling").
+
+And the reason for the EOL confusion is that we treat EOF as a special
+EOL condition, with the EOL character being NUL (aka "__DISABLED_CHAR"
+in the kernel sources).
+
+So that EOF look-ahead also affects the normal EOL handling.
+
+This patch just removes the look-ahead that causes problems, because EOL
+is much more critical than the historical "EOF in the middle of a line
+that coincides with the end of the buffer" handling ever was.
+
+Now, it is possible that we should indeed re-introduce the "look at next
+character to see if it's a EOF" behavior, but if so, that should be done
+not at the kernel buffer chunk boundary in canon_copy_from_read_buf(),
+but at a higher level, when we run out of the user buffer.
+
+In particular, the place to do that would be at the top of
+'n_tty_read()', where we check if it's a continuation of a previously
+started read, and there is no more buffer space left, we could decide to
+just eat the __DISABLED_CHAR at that point.
+
+But that would be a separate patch, because I suspect nobody actually
+cares, and I'd like to get a report about it before bothering.
+
+Fixes: 3b830a9c34d5 ("tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer")
+Fixes: ac8f3bf8832a ("n_tty: Fix  poll() after buffer-limited eof push read")
+Fixes: 40d5e0905a03 ("n_tty: Fix EOF push handling")
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=215611
+Reported-and-tested-by: Daniel Gibson <metalcaedes@gmail.com>
+Cc: Peter Hurley <peter@hurleysoftware.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Jiri Slaby <jirislaby@kernel.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/n_tty.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/tty/n_tty.c
++++ b/drivers/tty/n_tty.c
+@@ -2024,7 +2024,7 @@ static bool canon_copy_from_read_buf(str
+               return false;
+       canon_head = smp_load_acquire(&ldata->canon_head);
+-      n = min(*nr + 1, canon_head - ldata->read_tail);
++      n = min(*nr, canon_head - ldata->read_tail);
+       tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1);
+       size = min_t(size_t, tail + n, N_TTY_BUF_SIZE);
+@@ -2046,10 +2046,8 @@ static bool canon_copy_from_read_buf(str
+               n += N_TTY_BUF_SIZE;
+       c = n + found;
+-      if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) {
+-              c = min(*nr, c);
++      if (!found || read_buf(ldata, eol) != __DISABLED_CHAR)
+               n = c;
+-      }
+       n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n",
+                   __func__, eol, found, n, c, tail, more);