From: Greg Kroah-Hartman Date: Sun, 3 Sep 2023 12:52:01 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v6.5.2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd797e21727a0e0d5bef932f2c58c73af2c099d9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: firmware-stratix10-svc-fix-an-null-vs-is_err-bug-in-probe.patch fsi-master-ast-cf-add-module_firmware-macro.patch nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch serial-qcom-geni-fix-opp-vote-on-shutdown.patch serial-sc16is7xx-fix-broken-port-0-uart-init.patch serial-sc16is7xx-fix-bug-when-first-setting-gpio-direction.patch --- diff --git a/queue-5.10/firmware-stratix10-svc-fix-an-null-vs-is_err-bug-in-probe.patch b/queue-5.10/firmware-stratix10-svc-fix-an-null-vs-is_err-bug-in-probe.patch new file mode 100644 index 00000000000..a6f4a57b496 --- /dev/null +++ b/queue-5.10/firmware-stratix10-svc-fix-an-null-vs-is_err-bug-in-probe.patch @@ -0,0 +1,33 @@ +From dd218433f2b635d97e8fda3eed047151fd528ce4 Mon Sep 17 00:00:00 2001 +From: Wang Ming +Date: Thu, 27 Jul 2023 14:37:50 -0500 +Subject: firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe + +From: Wang Ming + +commit dd218433f2b635d97e8fda3eed047151fd528ce4 upstream. + +The devm_memremap() function returns error pointers. +It never returns NULL. Fix the check. + +Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver") +Cc: stable@vger.kernel.org +Signed-off-by: Wang Ming +Signed-off-by: Dinh Nguyen +Link: https://lore.kernel.org/r/20230727193750.983795-1-dinguyen@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/stratix10-svc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/firmware/stratix10-svc.c ++++ b/drivers/firmware/stratix10-svc.c +@@ -623,7 +623,7 @@ svc_create_memory_pool(struct platform_d + paddr = begin; + size = end - begin; + va = devm_memremap(dev, paddr, size, MEMREMAP_WC); +- if (!va) { ++ if (IS_ERR(va)) { + dev_err(dev, "fail to remap shared memory\n"); + return ERR_PTR(-EINVAL); + } diff --git a/queue-5.10/fsi-master-ast-cf-add-module_firmware-macro.patch b/queue-5.10/fsi-master-ast-cf-add-module_firmware-macro.patch new file mode 100644 index 00000000000..e4b2ecf4fdb --- /dev/null +++ b/queue-5.10/fsi-master-ast-cf-add-module_firmware-macro.patch @@ -0,0 +1,29 @@ +From 3a1d7aff6e65ad6e285e28abe55abbfd484997ee Mon Sep 17 00:00:00 2001 +From: Juerg Haefliger +Date: Wed, 28 Jun 2023 11:50:39 +0200 +Subject: fsi: master-ast-cf: Add MODULE_FIRMWARE macro + +From: Juerg Haefliger + +commit 3a1d7aff6e65ad6e285e28abe55abbfd484997ee upstream. + +The module loads firmware so add a MODULE_FIRMWARE macro to provide that +information via modinfo. + +Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire") +Cc: stable@vger.kernel.org # 4.19+ +Signed-off-by: Juerg Haefliger +Link: https://lore.kernel.org/r/20230628095039.26218-1-juerg.haefliger@canonical.com +Signed-off-by: Joel Stanley +Signed-off-by: Greg Kroah-Hartman +--- + drivers/fsi/fsi-master-ast-cf.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/fsi/fsi-master-ast-cf.c ++++ b/drivers/fsi/fsi-master-ast-cf.c +@@ -1440,3 +1440,4 @@ static struct platform_driver fsi_master + + module_platform_driver(fsi_master_acf); + MODULE_LICENSE("GPL"); ++MODULE_FIRMWARE(FW_FILE_NAME); diff --git a/queue-5.10/nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch b/queue-5.10/nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch new file mode 100644 index 00000000000..5a0247c0cde --- /dev/null +++ b/queue-5.10/nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch @@ -0,0 +1,48 @@ +From f83913f8c5b882a312e72b7669762f8a5c9385e4 Mon Sep 17 00:00:00 2001 +From: Ryusuke Konishi +Date: Sat, 5 Aug 2023 22:20:38 +0900 +Subject: nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers() + +From: Ryusuke Konishi + +commit f83913f8c5b882a312e72b7669762f8a5c9385e4 upstream. + +A syzbot stress test reported that create_empty_buffers() called from +nilfs_lookup_dirty_data_buffers() can cause a general protection fault. + +Analysis using its reproducer revealed that the back reference "mapping" +from a page/folio has been changed to NULL after dirty page/folio gang +lookup in nilfs_lookup_dirty_data_buffers(). + +Fix this issue by excluding pages/folios from being collected if, after +acquiring a lock on each page/folio, its back reference "mapping" differs +from the pointer to the address space struct that held the page/folio. + +Link: https://lkml.kernel.org/r/20230805132038.6435-1-konishi.ryusuke@gmail.com +Signed-off-by: Ryusuke Konishi +Reported-by: syzbot+0ad741797f4565e7e2d2@syzkaller.appspotmail.com +Closes: https://lkml.kernel.org/r/0000000000002930a705fc32b231@google.com +Tested-by: Ryusuke Konishi +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Ryusuke Konishi +Signed-off-by: Greg Kroah-Hartman +--- +fs/nilfs2/segment.c | 5 +++++ + fs/nilfs2/segment.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/fs/nilfs2/segment.c ++++ b/fs/nilfs2/segment.c +@@ -730,6 +730,11 @@ static size_t nilfs_lookup_dirty_data_bu + struct page *page = pvec.pages[i]; + + lock_page(page); ++ if (unlikely(page->mapping != mapping)) { ++ /* Exclude pages removed from the address space */ ++ unlock_page(page); ++ continue; ++ } + if (!page_has_buffers(page)) + create_empty_buffers(page, i_blocksize(inode), 0); + unlock_page(page); diff --git a/queue-5.10/serial-qcom-geni-fix-opp-vote-on-shutdown.patch b/queue-5.10/serial-qcom-geni-fix-opp-vote-on-shutdown.patch new file mode 100644 index 00000000000..9e163a1ae6c --- /dev/null +++ b/queue-5.10/serial-qcom-geni-fix-opp-vote-on-shutdown.patch @@ -0,0 +1,58 @@ +From 8ece7b754bc34ffd7fcc8269ccb9128e72ca76d8 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Fri, 14 Jul 2023 15:02:13 +0200 +Subject: serial: qcom-geni: fix opp vote on shutdown + +From: Johan Hovold + +commit 8ece7b754bc34ffd7fcc8269ccb9128e72ca76d8 upstream. + +The operating-performance-point vote needs to be dropped when shutting +down the port to avoid wasting power by keeping resources like power +domains in an unnecessarily high performance state (e.g. when a UART +connected Bluetooth controller is not in use). + +Fixes: a5819b548af0 ("tty: serial: qcom_geni_serial: Use OPP API to set clk/perf state") +Cc: stable@vger.kernel.org # 5.9 +Cc: Rajendra Nayak +Cc: Matthias Kaehlcke +Signed-off-by: Johan Hovold +Acked-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230714130214.14552-2-johan+linaro@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/qcom_geni_serial.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/tty/serial/qcom_geni_serial.c ++++ b/drivers/tty/serial/qcom_geni_serial.c +@@ -125,6 +125,7 @@ struct qcom_geni_serial_port { + u32 tx_fifo_width; + u32 rx_fifo_depth; + bool setup; ++ unsigned long clk_rate; + int (*handle_rx)(struct uart_port *uport, u32 bytes, bool drop); + unsigned int baud; + void *rx_fifo; +@@ -1022,6 +1023,7 @@ static void qcom_geni_serial_set_termios + goto out_restart_rx; + + uport->uartclk = clk_rate; ++ port->clk_rate = clk_rate; + dev_pm_opp_set_rate(uport->dev, clk_rate); + ser_clk_cfg = SER_CLK_EN; + ser_clk_cfg |= clk_div << CLK_DIV_SHFT; +@@ -1305,10 +1307,13 @@ static void qcom_geni_serial_pm(struct u + + if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) { + geni_icc_enable(&port->se); ++ if (port->clk_rate) ++ dev_pm_opp_set_rate(uport->dev, port->clk_rate); + geni_se_resources_on(&port->se); + } else if (new_state == UART_PM_STATE_OFF && + old_state == UART_PM_STATE_ON) { + geni_se_resources_off(&port->se); ++ dev_pm_opp_set_rate(uport->dev, 0); + geni_icc_disable(&port->se); + } + } diff --git a/queue-5.10/serial-sc16is7xx-fix-broken-port-0-uart-init.patch b/queue-5.10/serial-sc16is7xx-fix-broken-port-0-uart-init.patch new file mode 100644 index 00000000000..9a9c6f85b55 --- /dev/null +++ b/queue-5.10/serial-sc16is7xx-fix-broken-port-0-uart-init.patch @@ -0,0 +1,67 @@ +From 2861ed4d6e6d1a2c9de9bf5b0abd996c2dc673d0 Mon Sep 17 00:00:00 2001 +From: Hugo Villeneuve +Date: Mon, 7 Aug 2023 17:45:51 -0400 +Subject: serial: sc16is7xx: fix broken port 0 uart init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Hugo Villeneuve + +commit 2861ed4d6e6d1a2c9de9bf5b0abd996c2dc673d0 upstream. + +The sc16is7xx_config_rs485() function is called only for the second +port (index 1, channel B), causing initialization problems for the +first port. + +For the sc16is7xx driver, port->membase and port->mapbase are not set, +and their default values are 0. And we set port->iobase to the device +index. This means that when the first device is registered using the +uart_add_one_port() function, the following values will be in the port +structure: + port->membase = 0 + port->mapbase = 0 + port->iobase = 0 + +Therefore, the function uart_configure_port() in serial_core.c will +exit early because of the following check: + /* + * If there isn't a port here, don't do anything further. + */ + if (!port->iobase && !port->mapbase && !port->membase) + return; + +Typically, I2C and SPI drivers do not set port->membase and +port->mapbase. + +The max310x driver sets port->membase to ~0 (all ones). By +implementing the same change in this driver, uart_configure_port() is +now correctly executed for all ports. + +Fixes: dfeae619d781 ("serial: sc16is7xx") +Cc: stable@vger.kernel.org +Signed-off-by: Hugo Villeneuve +Reviewed-by: Ilpo Järvinen +Reviewed-by: Lech Perczak +Tested-by: Lech Perczak +Link: https://lore.kernel.org/r/20230807214556.540627-2-hugo@hugovil.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/sc16is7xx.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -1256,6 +1256,12 @@ static int sc16is7xx_probe(struct device + s->p[i].port.fifosize = SC16IS7XX_FIFO_SIZE; + s->p[i].port.flags = UPF_FIXED_TYPE | UPF_LOW_LATENCY; + s->p[i].port.iobase = i; ++ /* ++ * Use all ones as membase to make sure uart_configure_port() in ++ * serial_core.c does not abort for SPI/I2C devices where the ++ * membase address is not applicable. ++ */ ++ s->p[i].port.membase = (void __iomem *)~0; + s->p[i].port.iotype = UPIO_PORT; + s->p[i].port.uartclk = freq; + s->p[i].port.rs485_config = sc16is7xx_config_rs485; diff --git a/queue-5.10/serial-sc16is7xx-fix-bug-when-first-setting-gpio-direction.patch b/queue-5.10/serial-sc16is7xx-fix-bug-when-first-setting-gpio-direction.patch new file mode 100644 index 00000000000..7e9ebf5d008 --- /dev/null +++ b/queue-5.10/serial-sc16is7xx-fix-bug-when-first-setting-gpio-direction.patch @@ -0,0 +1,59 @@ +From 9baeea723c0fb9c3ba9a336369f758ed9bc6831d Mon Sep 17 00:00:00 2001 +From: Hugo Villeneuve +Date: Mon, 7 Aug 2023 17:45:55 -0400 +Subject: serial: sc16is7xx: fix bug when first setting GPIO direction + +From: Hugo Villeneuve + +commit 9baeea723c0fb9c3ba9a336369f758ed9bc6831d upstream. + +When configuring a pin as an output pin with a value of logic 0, we +end up as having a value of logic 1 on the output pin. Setting a +logic 0 a second time (or more) after that will correctly output a +logic 0 on the output pin. + +By default, all GPIO pins are configured as inputs. When we enter +sc16is7xx_gpio_direction_output() for the first time, we first set the +desired value in IOSTATE, and then we configure the pin as an output. +The datasheet states that writing to IOSTATE register will trigger a +transfer of the value to the I/O pin configured as output, so if the +pin is configured as an input, nothing will be transferred. + +Therefore, set the direction first in IODIR, and then set the desired +value in IOSTATE. + +This is what is done in NXP application note AN10587. + +Fixes: dfeae619d781 ("serial: sc16is7xx") +Cc: stable@vger.kernel.org +Signed-off-by: Hugo Villeneuve +Reviewed-by: Lech Perczak +Tested-by: Lech Perczak +Link: https://lore.kernel.org/r/20230807214556.540627-6-hugo@hugovil.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/sc16is7xx.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -1170,9 +1170,18 @@ static int sc16is7xx_gpio_direction_outp + state |= BIT(offset); + else + state &= ~BIT(offset); +- sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state); ++ ++ /* ++ * If we write IOSTATE first, and then IODIR, the output value is not ++ * transferred to the corresponding I/O pin. ++ * The datasheet states that each register bit will be transferred to ++ * the corresponding I/O pin programmed as output when writing to ++ * IOSTATE. Therefore, configure direction first with IODIR, and then ++ * set value after with IOSTATE. ++ */ + sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), + BIT(offset)); ++ sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state); + + return 0; + } diff --git a/queue-5.10/series b/queue-5.10/series index c5f78753087..73abb2d26e4 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -12,3 +12,9 @@ hid-wacom-remove-the-battery-when-the-ekr-is-off.patch staging-rtl8712-fix-race-condition.patch bluetooth-btsdio-fix-use-after-free-bug-in-btsdio_remove-due-to-race-condition.patch configfs-fix-a-race-in-configfs_lookup.patch +serial-qcom-geni-fix-opp-vote-on-shutdown.patch +serial-sc16is7xx-fix-broken-port-0-uart-init.patch +serial-sc16is7xx-fix-bug-when-first-setting-gpio-direction.patch +firmware-stratix10-svc-fix-an-null-vs-is_err-bug-in-probe.patch +fsi-master-ast-cf-add-module_firmware-macro.patch +nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch