From: Greg Kroah-Hartman Date: Sun, 26 Sep 2021 13:15:17 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.4.150~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=645af4aade52a73872349dc3173fb5d19d7c9b91;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: btrfs-prevent-__btrfs_dump_space_info-to-underflow-its-free-space.patch erofs-fix-up-erofs_lookup-tracepoint.patch net-hso-fix-muxed-tty-registration.patch serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch xhci-set-hcd-flag-to-defer-primary-roothub-registration.patch --- diff --git a/queue-5.4/btrfs-prevent-__btrfs_dump_space_info-to-underflow-its-free-space.patch b/queue-5.4/btrfs-prevent-__btrfs_dump_space_info-to-underflow-its-free-space.patch new file mode 100644 index 00000000000..2642540c396 --- /dev/null +++ b/queue-5.4/btrfs-prevent-__btrfs_dump_space_info-to-underflow-its-free-space.patch @@ -0,0 +1,48 @@ +From 0619b7901473c380abc05d45cf9c70bee0707db3 Mon Sep 17 00:00:00 2001 +From: Qu Wenruo +Date: Thu, 16 Sep 2021 20:43:29 +0800 +Subject: btrfs: prevent __btrfs_dump_space_info() to underflow its free space + +From: Qu Wenruo + +commit 0619b7901473c380abc05d45cf9c70bee0707db3 upstream. + +It's not uncommon where __btrfs_dump_space_info() gets called +under over-commit situations. + +In that case free space would underflow as total allocated space is not +enough to handle all the over-committed space. + +Such underflow values can sometimes cause confusion for users enabled +enospc_debug mount option, and takes some seconds for developers to +convert the underflow value to signed result. + +Just output the free space as s64 to avoid such problem. + +Reported-by: Eli V +Link: https://lore.kernel.org/linux-btrfs/CAJtFHUSy4zgyhf-4d9T+KdJp9w=UgzC2A0V=VtmaeEpcGgm1-Q@mail.gmail.com/ +CC: stable@vger.kernel.org # 5.4+ +Reviewed-by: Anand Jain +Signed-off-by: Qu Wenruo +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/space-info.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/fs/btrfs/space-info.c ++++ b/fs/btrfs/space-info.c +@@ -262,9 +262,10 @@ static void __btrfs_dump_space_info(stru + { + lockdep_assert_held(&info->lock); + +- btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull", ++ /* The free space could be negative in case of overcommit */ ++ btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull", + info->flags, +- info->total_bytes - btrfs_space_info_used(info, true), ++ (s64)(info->total_bytes - btrfs_space_info_used(info, true)), + info->full ? "" : "not "); + btrfs_info(fs_info, + "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu", diff --git a/queue-5.4/erofs-fix-up-erofs_lookup-tracepoint.patch b/queue-5.4/erofs-fix-up-erofs_lookup-tracepoint.patch new file mode 100644 index 00000000000..36d5424ea31 --- /dev/null +++ b/queue-5.4/erofs-fix-up-erofs_lookup-tracepoint.patch @@ -0,0 +1,48 @@ +From 93368aab0efc87288cac65e99c9ed2e0ffc9e7d0 Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Tue, 21 Sep 2021 22:35:30 +0800 +Subject: erofs: fix up erofs_lookup tracepoint + +From: Gao Xiang + +commit 93368aab0efc87288cac65e99c9ed2e0ffc9e7d0 upstream. + +Fix up a misuse that the filename pointer isn't always valid in +the ring buffer, and we should copy the content instead. + +Link: https://lore.kernel.org/r/20210921143531.81356-1-hsiangkao@linux.alibaba.com +Fixes: 13f06f48f7bf ("staging: erofs: support tracepoint") +Cc: stable@vger.kernel.org # 4.19+ +Reviewed-by: Chao Yu +Signed-off-by: Gao Xiang +Signed-off-by: Greg Kroah-Hartman +--- + include/trace/events/erofs.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/include/trace/events/erofs.h ++++ b/include/trace/events/erofs.h +@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup, + TP_STRUCT__entry( + __field(dev_t, dev ) + __field(erofs_nid_t, nid ) +- __field(const char *, name ) ++ __string(name, dentry->d_name.name ) + __field(unsigned int, flags ) + ), + + TP_fast_assign( + __entry->dev = dir->i_sb->s_dev; + __entry->nid = EROFS_I(dir)->nid; +- __entry->name = dentry->d_name.name; ++ __assign_str(name, dentry->d_name.name); + __entry->flags = flags; + ), + + TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", + show_dev_nid(__entry), +- __entry->name, ++ __get_str(name), + __entry->flags) + ); + diff --git a/queue-5.4/net-hso-fix-muxed-tty-registration.patch b/queue-5.4/net-hso-fix-muxed-tty-registration.patch new file mode 100644 index 00000000000..556501b453f --- /dev/null +++ b/queue-5.4/net-hso-fix-muxed-tty-registration.patch @@ -0,0 +1,59 @@ +From e8f69b16ee776da88589b5271e3f46020efc8f6c Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Fri, 17 Sep 2021 12:12:04 +0200 +Subject: net: hso: fix muxed tty registration + +From: Johan Hovold + +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 +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -2704,14 +2704,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; +@@ -2727,11 +2727,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-5.4/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch b/queue-5.4/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch new file mode 100644 index 00000000000..4471664e7c5 --- /dev/null +++ b/queue-5.4/serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch @@ -0,0 +1,44 @@ +From 74e1eb3b4a1ef2e564b4bdeb6e92afe844e900de Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +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 + +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 +Signed-off-by: Pali Rohár +Link: https://lore.kernel.org/r/20210911132017.25505-1-pali@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -164,7 +164,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) diff --git a/queue-5.4/series b/queue-5.4/series index 8d9b4a3e30e..f9f0293c8ff 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -17,3 +17,8 @@ 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 +erofs-fix-up-erofs_lookup-tracepoint.patch +btrfs-prevent-__btrfs_dump_space_info-to-underflow-its-free-space.patch +xhci-set-hcd-flag-to-defer-primary-roothub-registration.patch +serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch +net-hso-fix-muxed-tty-registration.patch diff --git a/queue-5.4/xhci-set-hcd-flag-to-defer-primary-roothub-registration.patch b/queue-5.4/xhci-set-hcd-flag-to-defer-primary-roothub-registration.patch new file mode 100644 index 00000000000..9859deeb63e --- /dev/null +++ b/queue-5.4/xhci-set-hcd-flag-to-defer-primary-roothub-registration.patch @@ -0,0 +1,36 @@ +From b7a0a792f864583207c593b50fd1b752ed89f4c1 Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Thu, 9 Sep 2021 12:11:59 +0530 +Subject: xhci: Set HCD flag to defer primary roothub registration + +From: Kishon Vijay Abraham I + +commit b7a0a792f864583207c593b50fd1b752ed89f4c1 upstream. + +Set "HCD_FLAG_DEFER_RH_REGISTER" to hcd->flags in xhci_run() to defer +registering primary roothub in usb_add_hcd(). This will make sure both +primary roothub and secondary roothub will be registered along with the +second HCD. This is required for cold plugged USB devices to be detected +in certain PCIe USB cards (like Inateck USB card connected to AM64 EVM +or J7200 EVM). + +CC: stable@vger.kernel.org # 5.4+ +Suggested-by: Mathias Nyman +Tested-by: Chris Chiu +Signed-off-by: Kishon Vijay Abraham I +Link: https://lore.kernel.org/r/20210909064200.16216-3-kishon@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -693,6 +693,7 @@ int xhci_run(struct usb_hcd *hcd) + if (ret) + xhci_free_command(xhci, command); + } ++ set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "Finished xhci_run for USB2 roothub"); +