]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Sep 2022 07:40:50 +0000 (09:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Sep 2022 07:40:50 +0000 (09:40 +0200)
added patches:
s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch
serial-create-uart_xmit_advance.patch
serial-fsl_lpuart-reset-prior-to-registration.patch
serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch
serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch

queue-5.15/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch [new file with mode: 0644]
queue-5.15/serial-create-uart_xmit_advance.patch [new file with mode: 0644]
queue-5.15/serial-fsl_lpuart-reset-prior-to-registration.patch [new file with mode: 0644]
queue-5.15/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch [new file with mode: 0644]
queue-5.15/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch b/queue-5.15/s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch
new file mode 100644 (file)
index 0000000..750f097
--- /dev/null
@@ -0,0 +1,59 @@
+From db7ba07108a48c0f95b74fabbfd5d63e924f992d Mon Sep 17 00:00:00 2001
+From: Stefan Haberland <sth@linux.ibm.com>
+Date: Mon, 19 Sep 2022 17:49:31 +0200
+Subject: s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup
+
+From: Stefan Haberland <sth@linux.ibm.com>
+
+commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream.
+
+Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup
+pointer being NULL.
+
+The pavgroup pointer is checked on the entrance of the function but
+without the lcu->lock being held. Therefore there is a race window
+between dasd_alias_get_start_dev() and _lcu_update() which sets
+pavgroup to NULL with the lcu->lock held.
+
+Fix by checking the pavgroup pointer with lcu->lock held.
+
+Cc: <stable@vger.kernel.org> # 2.6.25+
+Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
+Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
+Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
+Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/s390/block/dasd_alias.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/s390/block/dasd_alias.c
++++ b/drivers/s390/block/dasd_alias.c
+@@ -675,12 +675,12 @@ int dasd_alias_remove_device(struct dasd
+ struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device)
+ {
+       struct dasd_eckd_private *alias_priv, *private = base_device->private;
+-      struct alias_pav_group *group = private->pavgroup;
+       struct alias_lcu *lcu = private->lcu;
+       struct dasd_device *alias_device;
++      struct alias_pav_group *group;
+       unsigned long flags;
+-      if (!group || !lcu)
++      if (!lcu)
+               return NULL;
+       if (lcu->pav == NO_PAV ||
+           lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING))
+@@ -697,6 +697,11 @@ struct dasd_device *dasd_alias_get_start
+       }
+       spin_lock_irqsave(&lcu->lock, flags);
++      group = private->pavgroup;
++      if (!group) {
++              spin_unlock_irqrestore(&lcu->lock, flags);
++              return NULL;
++      }
+       alias_device = group->next;
+       if (!alias_device) {
+               if (list_empty(&group->aliaslist)) {
diff --git a/queue-5.15/serial-create-uart_xmit_advance.patch b/queue-5.15/serial-create-uart_xmit_advance.patch
new file mode 100644 (file)
index 0000000..ee018f5
--- /dev/null
@@ -0,0 +1,51 @@
+From e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Thu, 1 Sep 2022 17:39:32 +0300
+Subject: serial: Create uart_xmit_advance()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit e77cab77f2cb3a1ca2ba8df4af45bb35617ac16d upstream.
+
+A very common pattern in the drivers is to advance xmit tail
+index and do bookkeeping of Tx'ed characters. Create
+uart_xmit_advance() to handle it.
+
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220901143934.8850-2-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/serial_core.h |   17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -300,6 +300,23 @@ struct uart_state {
+ /* number of characters left in xmit buffer before we ask for more */
+ #define WAKEUP_CHARS          256
++/**
++ * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars
++ * @up: uart_port structure describing the port
++ * @chars: number of characters sent
++ *
++ * This function advances the tail of circular xmit buffer by the number of
++ * @chars transmitted and handles accounting of transmitted bytes (into
++ * @up's icount.tx).
++ */
++static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars)
++{
++      struct circ_buf *xmit = &up->state->xmit;
++
++      xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1);
++      up->icount.tx += chars;
++}
++
+ struct module;
+ struct tty_driver;
diff --git a/queue-5.15/serial-fsl_lpuart-reset-prior-to-registration.patch b/queue-5.15/serial-fsl_lpuart-reset-prior-to-registration.patch
new file mode 100644 (file)
index 0000000..950406b
--- /dev/null
@@ -0,0 +1,63 @@
+From 60f361722ad2ae5ee667d0b0545d40c42f754daf Mon Sep 17 00:00:00 2001
+From: Lukas Wunner <lukas@wunner.de>
+Date: Sun, 11 Sep 2022 10:22:01 +0200
+Subject: serial: fsl_lpuart: Reset prior to registration
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Lukas Wunner <lukas@wunner.de>
+
+commit 60f361722ad2ae5ee667d0b0545d40c42f754daf upstream.
+
+Since commit bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset
+for imx7ulp and imx8qxp"), certain i.MX UARTs are reset after they've
+already been registered.  Register state may thus be clobbered after
+user space has begun to open and access the UART.
+
+Avoid by performing the reset prior to registration.
+
+Fixes: bd5305dcabbc ("tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp")
+Cc: stable@vger.kernel.org # v5.15+
+Cc: Fugang Duan <fugang.duan@nxp.com>
+Cc: Sherry Sun <sherry.sun@nxp.com>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Lukas Wunner <lukas@wunner.de>
+Link: https://lore.kernel.org/r/72fb646c1b0b11c989850c55f52f9ff343d1b2fa.1662884345.git.lukas@wunner.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/fsl_lpuart.c |    9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/drivers/tty/serial/fsl_lpuart.c
++++ b/drivers/tty/serial/fsl_lpuart.c
+@@ -2726,14 +2726,15 @@ static int lpuart_probe(struct platform_
+               lpuart_reg.cons = LPUART_CONSOLE;
+               handler = lpuart_int;
+       }
+-      ret = uart_add_one_port(&lpuart_reg, &sport->port);
+-      if (ret)
+-              goto failed_attach_port;
+       ret = lpuart_global_reset(sport);
+       if (ret)
+               goto failed_reset;
++      ret = uart_add_one_port(&lpuart_reg, &sport->port);
++      if (ret)
++              goto failed_attach_port;
++
+       ret = uart_get_rs485_mode(&sport->port);
+       if (ret)
+               goto failed_get_rs485;
+@@ -2756,9 +2757,9 @@ static int lpuart_probe(struct platform_
+ failed_irq_request:
+ failed_get_rs485:
+-failed_reset:
+       uart_remove_one_port(&lpuart_reg, &sport->port);
+ failed_attach_port:
++failed_reset:
+       lpuart_disable_clks(sport);
+       return ret;
+ }
diff --git a/queue-5.15/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch b/queue-5.15/serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch
new file mode 100644 (file)
index 0000000..877d7e7
--- /dev/null
@@ -0,0 +1,36 @@
+From 1d10cd4da593bc0196a239dcc54dac24b6b0a74e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Thu, 1 Sep 2022 17:39:34 +0300
+Subject: serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit 1d10cd4da593bc0196a239dcc54dac24b6b0a74e upstream.
+
+Tx'ing does not correctly account Tx'ed characters into icount.tx.
+Using uart_xmit_advance() fixes the problem.
+
+Fixes: 2d908b38d409 ("serial: Add Tegra Combined UART driver")
+Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220901143934.8850-4-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/tegra-tcu.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/tegra-tcu.c
++++ b/drivers/tty/serial/tegra-tcu.c
+@@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(stru
+                       break;
+               tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count);
+-              xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
++              uart_xmit_advance(port, count);
+       }
+       uart_write_wakeup(port);
diff --git a/queue-5.15/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch b/queue-5.15/serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch
new file mode 100644 (file)
index 0000000..5df060e
--- /dev/null
@@ -0,0 +1,53 @@
+From 754f68044c7dd6c52534ba3e0f664830285c4b15 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Thu, 1 Sep 2022 17:39:33 +0300
+Subject: serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+
+commit 754f68044c7dd6c52534ba3e0f664830285c4b15 upstream.
+
+DMA complete & stop paths did not correctly account Tx'ed characters
+into icount.tx. Using uart_xmit_advance() fixes the problem.
+
+Fixes: e9ea096dd225 ("serial: tegra: add serial driver")
+Cc: <stable@vger.kernel.org> # serial: Create uart_xmit_advance()
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/serial-tegra.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/tty/serial/serial-tegra.c
++++ b/drivers/tty/serial/serial-tegra.c
+@@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(v
+       count = tup->tx_bytes_requested - state.residue;
+       async_tx_ack(tup->tx_dma_desc);
+       spin_lock_irqsave(&tup->uport.lock, flags);
+-      xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
++      uart_xmit_advance(&tup->uport, count);
+       tup->tx_in_progress = 0;
+       if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
+               uart_write_wakeup(&tup->uport);
+@@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty(
+ static void tegra_uart_stop_tx(struct uart_port *u)
+ {
+       struct tegra_uart_port *tup = to_tegra_uport(u);
+-      struct circ_buf *xmit = &tup->uport.state->xmit;
+       struct dma_tx_state state;
+       unsigned int count;
+@@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct ua
+       dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
+       count = tup->tx_bytes_requested - state.residue;
+       async_tx_ack(tup->tx_dma_desc);
+-      xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
++      uart_xmit_advance(&tup->uport, count);
+       tup->tx_in_progress = 0;
+ }
index a4f41d281e1dfcb357c3aad64429c234ddfe1238..0ad6c328c4a71068637acfc2bd68f0aa06003d53 100644 (file)
@@ -115,3 +115,8 @@ net-sched-fix-possible-refcount-leak-in-tc_new_tfilt.patch
 bnxt-prevent-skb-uaf-after-handing-over-to-ptp-worke.patch
 selftests-forwarding-add-shebang-for-sch_red.sh.patch
 kvm-x86-mmu-fold-rmap_recycle-into-rmap_add.patch
+serial-fsl_lpuart-reset-prior-to-registration.patch
+serial-create-uart_xmit_advance.patch
+serial-tegra-use-uart_xmit_advance-fixes-icount.tx-accounting.patch
+serial-tegra-tcu-use-uart_xmit_advance-fixes-icount.tx-accounting.patch
+s390-dasd-fix-oops-in-dasd_alias_get_start_dev-due-to-missing-pavgroup.patch