]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 15:46:41 +0000 (17:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 15:46:41 +0000 (17:46 +0200)
added patches:
serial-fsl_lpuart-rs485-rts-polariy-is-inverse.patch
staging-r8188eu-add-firmware-dependency.patch
staging-r8188eu-add-rosewill-usb-n150-nano-to-device-tables.patch
staging-rtl8712-fix-use-after-free-bugs.patch
tty-serial-atmel-preserve-previous-usart-mode-if-rs485-disabled.patch

queue-5.19/serial-fsl_lpuart-rs485-rts-polariy-is-inverse.patch [new file with mode: 0644]
queue-5.19/series
queue-5.19/staging-r8188eu-add-firmware-dependency.patch [new file with mode: 0644]
queue-5.19/staging-r8188eu-add-rosewill-usb-n150-nano-to-device-tables.patch [new file with mode: 0644]
queue-5.19/staging-rtl8712-fix-use-after-free-bugs.patch [new file with mode: 0644]
queue-5.19/tty-serial-atmel-preserve-previous-usart-mode-if-rs485-disabled.patch [new file with mode: 0644]

diff --git a/queue-5.19/serial-fsl_lpuart-rs485-rts-polariy-is-inverse.patch b/queue-5.19/serial-fsl_lpuart-rs485-rts-polariy-is-inverse.patch
new file mode 100644 (file)
index 0000000..c43d580
--- /dev/null
@@ -0,0 +1,39 @@
+From 846651eca073e2e02e37490a4a52752415d84781 Mon Sep 17 00:00:00 2001
+From: Shenwei Wang <shenwei.wang@nxp.com>
+Date: Fri, 5 Aug 2022 09:45:29 -0500
+Subject: serial: fsl_lpuart: RS485 RTS polariy is inverse
+
+From: Shenwei Wang <shenwei.wang@nxp.com>
+
+commit 846651eca073e2e02e37490a4a52752415d84781 upstream.
+
+The setting of RS485 RTS polarity is inverse in the current driver.
+
+When the property of 'rs485-rts-active-low' is enabled in the dts node,
+the RTS signal should be LOW during sending. Otherwise, if there is no
+such a property, the RTS should be HIGH during sending.
+
+Fixes: 03895cf41d18 ("tty: serial: fsl_lpuart: Add support for RS-485")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Nicolas Diaz <nicolas.diaz@nxp.com>
+Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
+Link: https://lore.kernel.org/r/20220805144529.604856-1-shenwei.wang@nxp.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/fsl_lpuart.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/serial/fsl_lpuart.c
++++ b/drivers/tty/serial/fsl_lpuart.c
+@@ -1381,9 +1381,9 @@ static int lpuart_config_rs485(struct ua
+                * Note: UART is assumed to be active high.
+                */
+               if (rs485->flags & SER_RS485_RTS_ON_SEND)
+-                      modem &= ~UARTMODEM_TXRTSPOL;
+-              else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
+                       modem |= UARTMODEM_TXRTSPOL;
++              else if (rs485->flags & SER_RS485_RTS_AFTER_SEND)
++                      modem &= ~UARTMODEM_TXRTSPOL;
+       }
+       writeb(modem, sport->port.membase + UARTMODEM);
index 3287f61c6009bec969a1e9faaf7356591700b49e..841e9a617d20f2d9357aea3f4b1beeaebc70b467 100644 (file)
@@ -58,3 +58,8 @@ soundwire-qcom-fix-device-status-array-range.patch
 mm-slab_common-deleting-kobject-in-kmem_cache_destro.patch
 platform-mellanox-mlxreg-lc-fix-coverity-warning.patch
 platform-mellanox-mlxreg-lc-fix-locking-issue.patch
+serial-fsl_lpuart-rs485-rts-polariy-is-inverse.patch
+tty-serial-atmel-preserve-previous-usart-mode-if-rs485-disabled.patch
+staging-rtl8712-fix-use-after-free-bugs.patch
+staging-r8188eu-add-rosewill-usb-n150-nano-to-device-tables.patch
+staging-r8188eu-add-firmware-dependency.patch
diff --git a/queue-5.19/staging-r8188eu-add-firmware-dependency.patch b/queue-5.19/staging-r8188eu-add-firmware-dependency.patch
new file mode 100644 (file)
index 0000000..eab0453
--- /dev/null
@@ -0,0 +1,48 @@
+From b2fa9e13bbf101c662c4cd974608242a0db98cfc Mon Sep 17 00:00:00 2001
+From: Grzegorz Szymaszek <gszymaszek@short.pl>
+Date: Tue, 2 Aug 2022 19:18:44 +0200
+Subject: staging: r8188eu: add firmware dependency
+
+From: Grzegorz Szymaszek <gszymaszek@short.pl>
+
+commit b2fa9e13bbf101c662c4cd974608242a0db98cfc upstream.
+
+The old rtl8188eu module, removed in commit 55dfa29b43d2 ("staging:
+rtl8188eu: remove rtl8188eu driver from staging dir") (Linux kernel
+v5.15-rc1), required (through a MODULE_FIRMWARE call()) the
+rtlwifi/rtl8188eufw.bin firmware file, which the new r8188eu driver no
+longer requires.
+
+I have tested a few RTL8188EUS-based Wi-Fi cards and, while supported by
+both drivers, they do not work when using the new one and the firmware
+wasn't manually loaded. According to Larry Finger, the module
+maintainer, all such cards need the firmware and the driver should
+depend on it (see the linked mails).
+
+Add a proper MODULE_FIRMWARE() call, like it was done in the old driver.
+
+Thanks to Greg Kroah-Hartman and Larry Finger for quick responses to my
+questions.
+
+Cc: stable <stable@kernel.org>
+Link: https://answers.launchpad.net/ubuntu/+source/linux-meta-hwe-5.15/+question/702611
+Link: https://lore.kernel.org/lkml/YukkBu3TNODO3or9@nx64de-df6d00/
+Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
+Link: https://lore.kernel.org/r/YulcdKfhA8dPQ78s@nx64de-df6d00
+Acked-by: Phillip Potter <phil@philpotter.co.uk>
+Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/r8188eu/os_dep/os_intfs.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
++++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
+@@ -18,6 +18,7 @@ MODULE_LICENSE("GPL");
+ MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
+ MODULE_AUTHOR("Realtek Semiconductor Corp.");
+ MODULE_VERSION(DRIVERVERSION);
++MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
+ #define CONFIG_BR_EXT_BRNAME "br0"
+ #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
diff --git a/queue-5.19/staging-r8188eu-add-rosewill-usb-n150-nano-to-device-tables.patch b/queue-5.19/staging-r8188eu-add-rosewill-usb-n150-nano-to-device-tables.patch
new file mode 100644 (file)
index 0000000..ea31f97
--- /dev/null
@@ -0,0 +1,32 @@
+From e01f5c8d6af231b3b09e23c1fe8a4057cdcc4e42 Mon Sep 17 00:00:00 2001
+From: Larry Finger <Larry.Finger@lwfinger.net>
+Date: Sun, 14 Aug 2022 12:50:27 -0500
+Subject: staging: r8188eu: Add Rosewill USB-N150 Nano to device tables
+
+From: Larry Finger <Larry.Finger@lwfinger.net>
+
+commit e01f5c8d6af231b3b09e23c1fe8a4057cdcc4e42 upstream.
+
+This device is reported as using the RTL8188EUS chip.
+
+It has the improbable USB ID of 0bda:ffef, which normally would belong
+to Realtek, but this ID works for the reporter.
+
+Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20220814175027.2689-1-Larry.Finger@lwfinger.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/r8188eu/os_dep/usb_intf.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
++++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
+@@ -28,6 +28,7 @@ static struct usb_device_id rtw_usb_id_t
+       /*=== Realtek demoboard ===*/
+       {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */
+       {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
++      {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill USB-N150 Nano */
+       /*=== Customer ID ===*/
+       /****** 8188EUS ********/
+       {USB_DEVICE(0x07B8, 0x8179)}, /* Abocom - Abocom */
diff --git a/queue-5.19/staging-rtl8712-fix-use-after-free-bugs.patch b/queue-5.19/staging-rtl8712-fix-use-after-free-bugs.patch
new file mode 100644 (file)
index 0000000..d4ad9d8
--- /dev/null
@@ -0,0 +1,75 @@
+From e230a4455ac3e9b112f0367d1b8e255e141afae0 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Tue, 30 Aug 2022 17:55:07 +0300
+Subject: staging: rtl8712: fix use after free bugs
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit e230a4455ac3e9b112f0367d1b8e255e141afae0 upstream.
+
+_Read/Write_MACREG callbacks are NULL so the read/write_macreg_hdl()
+functions don't do anything except free the "pcmd" pointer.  It
+results in a use after free.  Delete them.
+
+Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
+Cc: stable <stable@kernel.org>
+Reported-by: Zheng Wang <hackerzheng666@gmail.com>
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/Yw4ASqkYcUhUfoY2@kili
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/rtl8712/rtl8712_cmd.c |   36 ----------------------------------
+ 1 file changed, 36 deletions(-)
+
+--- a/drivers/staging/rtl8712/rtl8712_cmd.c
++++ b/drivers/staging/rtl8712/rtl8712_cmd.c
+@@ -117,34 +117,6 @@ static void r871x_internal_cmd_hdl(struc
+       kfree(pdrvcmd->pbuf);
+ }
+-static u8 read_macreg_hdl(struct _adapter *padapter, u8 *pbuf)
+-{
+-      void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj      *pcmd);
+-      struct cmd_obj *pcmd  = (struct cmd_obj *)pbuf;
+-
+-      /*  invoke cmd->callback function */
+-      pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
+-      if (!pcmd_callback)
+-              r8712_free_cmd_obj(pcmd);
+-      else
+-              pcmd_callback(padapter, pcmd);
+-      return H2C_SUCCESS;
+-}
+-
+-static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf)
+-{
+-      void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj      *pcmd);
+-      struct cmd_obj *pcmd  = (struct cmd_obj *)pbuf;
+-
+-      /*  invoke cmd->callback function */
+-      pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
+-      if (!pcmd_callback)
+-              r8712_free_cmd_obj(pcmd);
+-      else
+-              pcmd_callback(padapter, pcmd);
+-      return H2C_SUCCESS;
+-}
+-
+ static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
+ {
+       struct cmd_obj *pcmd  = (struct cmd_obj *)pbuf;
+@@ -213,14 +185,6 @@ static struct cmd_obj *cmd_hdl_filter(st
+       pcmd_r = NULL;
+       switch (pcmd->cmdcode) {
+-      case GEN_CMD_CODE(_Read_MACREG):
+-              read_macreg_hdl(padapter, (u8 *)pcmd);
+-              pcmd_r = pcmd;
+-              break;
+-      case GEN_CMD_CODE(_Write_MACREG):
+-              write_macreg_hdl(padapter, (u8 *)pcmd);
+-              pcmd_r = pcmd;
+-              break;
+       case GEN_CMD_CODE(_Read_BBREG):
+               read_bbreg_hdl(padapter, (u8 *)pcmd);
+               break;
diff --git a/queue-5.19/tty-serial-atmel-preserve-previous-usart-mode-if-rs485-disabled.patch b/queue-5.19/tty-serial-atmel-preserve-previous-usart-mode-if-rs485-disabled.patch
new file mode 100644 (file)
index 0000000..aadf88b
--- /dev/null
@@ -0,0 +1,68 @@
+From 692a8ebcfc24f4a5bea0eb2967e450f584193da6 Mon Sep 17 00:00:00 2001
+From: Sergiu Moga <sergiu.moga@microchip.com>
+Date: Wed, 24 Aug 2022 17:29:03 +0300
+Subject: tty: serial: atmel: Preserve previous USART mode if RS485 disabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Sergiu Moga <sergiu.moga@microchip.com>
+
+commit 692a8ebcfc24f4a5bea0eb2967e450f584193da6 upstream.
+
+Whenever the atmel_rs485_config() driver method would be called,
+the USART mode is reset to normal mode before even checking if
+RS485 flag is set, thus resulting in losing the previous USART
+mode in the case where the checking fails.
+
+Some tools, such as `linux-serial-test`, lead to the driver calling
+this method when doing the setup of the serial port: after setting the
+port mode (Hardware Flow Control, Normal Mode, RS485 Mode, etc.),
+`linux-serial-test` tries to enable/disable RS485 depending on
+the commandline arguments that were passed.
+
+Example of how this issue could reveal itself:
+When doing a serial communication with Hardware Flow Control through
+`linux-serial-test`, the tool would lead to the driver roughly doing
+the following:
+- set the corresponding bit to 1 (ATMEL_US_USMODE_HWHS bit in the
+ATMEL_US_MR register) through the atmel_set_termios() to enable
+Hardware Flow Control
+- disable RS485 through the atmel_config_rs485() method
+Thus, when the latter is called, the mode will be reset and the
+previously set bit is unset, leaving USART in normal mode instead of
+the expected Hardware Flow Control mode.
+
+This fix ensures that this reset is only done if the checking for
+RS485 succeeds and that the previous mode is preserved otherwise.
+
+Fixes: e8faff7330a35 ("ARM: 6092/1: atmel_serial: support for RS485 communications")
+Cc: stable <stable@kernel.org>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
+Link: https://lore.kernel.org/r/20220824142902.502596-1-sergiu.moga@microchip.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/atmel_serial.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/tty/serial/atmel_serial.c
++++ b/drivers/tty/serial/atmel_serial.c
+@@ -296,9 +296,6 @@ static int atmel_config_rs485(struct uar
+       mode = atmel_uart_readl(port, ATMEL_US_MR);
+-      /* Resetting serial mode to RS232 (0x0) */
+-      mode &= ~ATMEL_US_USMODE;
+-
+       if (rs485conf->flags & SER_RS485_ENABLED) {
+               dev_dbg(port->dev, "Setting UART to RS485\n");
+               if (rs485conf->flags & SER_RS485_RX_DURING_TX)
+@@ -308,6 +305,7 @@ static int atmel_config_rs485(struct uar
+               atmel_uart_writel(port, ATMEL_US_TTGR,
+                                 rs485conf->delay_rts_after_send);
++              mode &= ~ATMEL_US_USMODE;
+               mode |= ATMEL_US_USMODE_RS485;
+       } else {
+               dev_dbg(port->dev, "Setting UART to RS232\n");