]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Sep 2021 13:14:45 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Sep 2021 13:14:45 +0000 (15:14 +0200)
added patches:
net-hso-fix-muxed-tty-registration.patch
serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch

queue-4.14/net-hso-fix-muxed-tty-registration.patch [new file with mode: 0644]
queue-4.14/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/net-hso-fix-muxed-tty-registration.patch b/queue-4.14/net-hso-fix-muxed-tty-registration.patch
new file mode 100644 (file)
index 0000000..3058807
--- /dev/null
@@ -0,0 +1,59 @@
+From e8f69b16ee776da88589b5271e3f46020efc8f6c Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Fri, 17 Sep 2021 12:12:04 +0200
+Subject: net: hso: fix muxed tty registration
+
+From: Johan Hovold <johan@kernel.org>
+
+commit e8f69b16ee776da88589b5271e3f46020efc8f6c upstream.
+
+If resource allocation and registration fail for a muxed tty device
+(e.g. if there are no more minor numbers) the driver should not try to
+deregister the never-registered (or already-deregistered) tty.
+
+Fix up the error handling to avoid dereferencing a NULL pointer when
+attempting to remove the character device.
+
+Fixes: 72dc1c096c70 ("HSO: add option hso driver")
+Cc: stable@vger.kernel.org     # 2.6.27
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/hso.c |   12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/usb/hso.c
++++ b/drivers/net/usb/hso.c
+@@ -2713,14 +2713,14 @@ struct hso_device *hso_create_mux_serial
+       serial = kzalloc(sizeof(*serial), GFP_KERNEL);
+       if (!serial)
+-              goto exit;
++              goto err_free_dev;
+       hso_dev->port_data.dev_serial = serial;
+       serial->parent = hso_dev;
+       if (hso_serial_common_create
+           (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE))
+-              goto exit;
++              goto err_free_serial;
+       serial->tx_data_length--;
+       serial->write_data = hso_mux_serial_write_data;
+@@ -2736,11 +2736,9 @@ struct hso_device *hso_create_mux_serial
+       /* done, return it */
+       return hso_dev;
+-exit:
+-      if (serial) {
+-              tty_unregister_device(tty_drv, serial->minor);
+-              kfree(serial);
+-      }
++err_free_serial:
++      kfree(serial);
++err_free_dev:
+       kfree(hso_dev);
+       return NULL;
diff --git a/queue-4.14/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch b/queue-4.14/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch
new file mode 100644 (file)
index 0000000..d07f6f0
--- /dev/null
@@ -0,0 +1,44 @@
+From 74e1eb3b4a1ef2e564b4bdeb6e92afe844e900de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+Date: Sat, 11 Sep 2021 15:20:17 +0200
+Subject: serial: mvebu-uart: fix driver's tx_empty callback
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pali Rohár <pali@kernel.org>
+
+commit 74e1eb3b4a1ef2e564b4bdeb6e92afe844e900de upstream.
+
+Driver's tx_empty callback should signal when the transmit shift register
+is empty. So when the last character has been sent.
+
+STAT_TX_FIFO_EMP bit signals only that HW transmit FIFO is empty, which
+happens when the last byte is loaded into transmit shift register.
+
+STAT_TX_EMP bit signals when the both HW transmit FIFO and transmit shift
+register are empty.
+
+So replace STAT_TX_FIFO_EMP check by STAT_TX_EMP in mvebu_uart_tx_empty()
+callback function.
+
+Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port")
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Link: https://lore.kernel.org/r/20210911132017.25505-1-pali@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/mvebu-uart.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/mvebu-uart.c
++++ b/drivers/tty/serial/mvebu-uart.c
+@@ -108,7 +108,7 @@ static unsigned int mvebu_uart_tx_empty(
+       st = readl(port->membase + UART_STAT);
+       spin_unlock_irqrestore(&port->lock, flags);
+-      return (st & STAT_TX_FIFO_EMP) ? TIOCSER_TEMT : 0;
++      return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0;
+ }
+ static unsigned int mvebu_uart_get_mctrl(struct uart_port *port)
index 8e81d0377031a7e743f488a916c56b4a7d4fcddb..835c6edac04763695ee13f570c498bd5bcf59d4b 100644 (file)
@@ -12,3 +12,5 @@ usb-serial-option-add-telit-ln920-compositions.patch
 usb-serial-option-remove-duplicate-usb-device-id.patch
 usb-serial-option-add-device-id-for-foxconn-t99w265.patch
 mcb-fix-error-handling-in-mcb_alloc_bus.patch
+serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch
+net-hso-fix-muxed-tty-registration.patch