]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Jul 2022 15:50:28 +0000 (17:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Jul 2022 15:50:28 +0000 (17:50 +0200)
added patches:
serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch
serial-stm32-clear-prev-values-before-setting-rts-delays.patch

queue-5.4/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch [new file with mode: 0644]
queue-5.4/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch [new file with mode: 0644]
queue-5.4/serial-stm32-clear-prev-values-before-setting-rts-delays.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch b/queue-5.4/serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
new file mode 100644 (file)
index 0000000..7dd0f61
--- /dev/null
@@ -0,0 +1,39 @@
+From 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 Mon Sep 17 00:00:00 2001
+From: Yi Yang <yiyang13@huawei.com>
+Date: Tue, 28 Jun 2022 16:35:15 +0800
+Subject: serial: 8250: fix return error code in serial8250_request_std_resource()
+
+From: Yi Yang <yiyang13@huawei.com>
+
+commit 6e690d54cfa802f939cefbd2fa2c91bd0b8bd1b6 upstream.
+
+If port->mapbase = NULL in serial8250_request_std_resource() , it need
+return a error code instead of 0. If uart_set_info() fail to request new
+regions by serial8250_request_std_resource() but the return value of
+serial8250_request_std_resource() is 0, The system incorrectly considers
+that the resource application is successful and does not attempt to
+restore the old setting. A null pointer reference is triggered when the
+port resource is later invoked.
+
+Signed-off-by: Yi Yang <yiyang13@huawei.com>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20220628083515.64138-1-yiyang13@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/8250/8250_port.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/8250/8250_port.c
++++ b/drivers/tty/serial/8250/8250_port.c
+@@ -2828,8 +2828,10 @@ static int serial8250_request_std_resour
+       case UPIO_MEM32BE:
+       case UPIO_MEM16:
+       case UPIO_MEM:
+-              if (!port->mapbase)
++              if (!port->mapbase) {
++                      ret = -EINVAL;
+                       break;
++              }
+               if (!request_mem_region(port->mapbase, size, "serial")) {
+                       ret = -EBUSY;
diff --git a/queue-5.4/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch b/queue-5.4/serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch
new file mode 100644 (file)
index 0000000..83978a4
--- /dev/null
@@ -0,0 +1,83 @@
+From 211565b100993c90b53bf40851eacaefc830cfe0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Tue, 14 Jun 2022 10:56:37 +0300
+Subject: serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle
+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 211565b100993c90b53bf40851eacaefc830cfe0 upstream.
+
+The driver must provide throttle and unthrottle in uart_ops when it
+sets UPSTAT_AUTORTS. Add them using existing stop_rx &
+enable_interrupts functions.
+
+Fixes: 2a76fa283098 (serial: pl011: Adopt generic flag to store auto RTS status)
+Cc: stable <stable@kernel.org>
+Cc: Lukas Wunner <lukas@wunner.de>
+Reported-by: Nuno Gonçalves <nunojpg@gmail.com>
+Tested-by: Nuno Gonçalves <nunojpg@gmail.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220614075637.8558-1-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/amba-pl011.c |   23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/serial/amba-pl011.c
++++ b/drivers/tty/serial/amba-pl011.c
+@@ -1335,6 +1335,15 @@ static void pl011_stop_rx(struct uart_po
+       pl011_dma_rx_stop(uap);
+ }
++static void pl011_throttle_rx(struct uart_port *port)
++{
++      unsigned long flags;
++
++      spin_lock_irqsave(&port->lock, flags);
++      pl011_stop_rx(port);
++      spin_unlock_irqrestore(&port->lock, flags);
++}
++
+ static void pl011_enable_ms(struct uart_port *port)
+ {
+       struct uart_amba_port *uap =
+@@ -1728,9 +1737,10 @@ static int pl011_allocate_irq(struct uar
+  */
+ static void pl011_enable_interrupts(struct uart_amba_port *uap)
+ {
++      unsigned long flags;
+       unsigned int i;
+-      spin_lock_irq(&uap->port.lock);
++      spin_lock_irqsave(&uap->port.lock, flags);
+       /* Clear out any spuriously appearing RX interrupts */
+       pl011_write(UART011_RTIS | UART011_RXIS, uap, REG_ICR);
+@@ -1752,7 +1762,14 @@ static void pl011_enable_interrupts(stru
+       if (!pl011_dma_rx_running(uap))
+               uap->im |= UART011_RXIM;
+       pl011_write(uap->im, uap, REG_IMSC);
+-      spin_unlock_irq(&uap->port.lock);
++      spin_unlock_irqrestore(&uap->port.lock, flags);
++}
++
++static void pl011_unthrottle_rx(struct uart_port *port)
++{
++      struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
++
++      pl011_enable_interrupts(uap);
+ }
+ static int pl011_startup(struct uart_port *port)
+@@ -2127,6 +2144,8 @@ static const struct uart_ops amba_pl011_
+       .stop_tx        = pl011_stop_tx,
+       .start_tx       = pl011_start_tx,
+       .stop_rx        = pl011_stop_rx,
++      .throttle       = pl011_throttle_rx,
++      .unthrottle     = pl011_unthrottle_rx,
+       .enable_ms      = pl011_enable_ms,
+       .break_ctl      = pl011_break_ctl,
+       .startup        = pl011_startup,
diff --git a/queue-5.4/serial-stm32-clear-prev-values-before-setting-rts-delays.patch b/queue-5.4/serial-stm32-clear-prev-values-before-setting-rts-delays.patch
new file mode 100644 (file)
index 0000000..d6e07a1
--- /dev/null
@@ -0,0 +1,37 @@
+From 5c5f44e36217de5ead789ff25da71c31c2331c96 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>
+Date: Mon, 27 Jun 2022 18:07:52 +0300
+Subject: serial: stm32: Clear prev values before setting RTS delays
+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 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream.
+
+The code lacks clearing of previous DEAT/DEDT values. Thus, changing
+values on the fly results in garbage delays tending towards the maximum
+value as more and more bits are ORed together. (Leaving RS485 mode
+would have cleared the old values though).
+
+Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/stm32-usart.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/tty/serial/stm32-usart.c
++++ b/drivers/tty/serial/stm32-usart.c
+@@ -73,6 +73,8 @@ static void stm32_config_reg_rs485(u32 *
+       *cr3 |= USART_CR3_DEM;
+       over8 = *cr1 & USART_CR1_OVER8;
++      *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);
++
+       if (over8)
+               rs485_deat_dedt = delay_ADE * baud * 8;
+       else
index 3ea10cb7362d4f63b5d0f9e37705f89a54eb31e2..7faa1551c4d4cd18d4060972844e5406253da671 100644 (file)
@@ -65,3 +65,6 @@ usb-serial-ftdi_sio-add-belimo-device-ids.patch
 usb-typec-add-missing-uevent-when-partner-support-pd.patch
 usb-dwc3-gadget-fix-event-pending-check.patch
 tty-serial-samsung_tty-set-dma-burst_size-to-1.patch
+serial-8250-fix-return-error-code-in-serial8250_request_std_resource.patch
+serial-stm32-clear-prev-values-before-setting-rts-delays.patch
+serial-pl011-upstat_autorts-requires-.throttle-unthrottle.patch