FAILED: patch "[PATCH] serial: sc16is7xx: fix invalid FIFO access with special" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 7d3b793faaab1305994ce568b59d61927235f57b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024081208-geometry-thread-d393@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
7d3b793faaab ("serial: sc16is7xx: fix invalid FIFO access with special register set") 8492bd91aa05 ("serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler") 0c84bea0cabc ("serial: sc16is7xx: refactor EFR lock")2de8a1b46756 ("serial: sc16is7xx: reorder code to remove prototype declarations") 2e57cefc4477 ("serial: sc16is7xx: replace hardcoded divisor value with BIT() macro") 4409df5866b7 ("serial: sc16is7xx: change EFR lock to operate on each channels") 3837a0379533 ("serial: sc16is7xx: improve regmap debugfs by using one regmap per port") 22a048b07493 ("serial: sc16is7xx: remove unused to_sc16is7xx_port macro") b4a778303ea0 ("serial: sc16is7xx: add missing support for rs485 devicetree properties") 049994292834 ("serial: sc16is7xx: fix regression with GPIO configuration") dabc54a45711 ("serial: sc16is7xx: remove obsolete out_thread label") c8f71b49ee4d ("serial: sc16is7xx: setup GPIO controller later in probe") 267913ecf737 ("serial: sc16is7xx: Fill in rs485_supported")6e124e58ae2e ("sc16is7xx: Set AUTOCTS and AUTORTS bits")21144bab4f11 ("sc16is7xx: Handle modem status lines")cc4c1d05eb10 ("sc16is7xx: Properly resume TX after stop")d4ab5487cc77 ("Merge 5.17-rc6 into tty-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7d3b793faaab1305994ce568b59d61927235f57b Mon Sep 17 00:00:00 2001
From: Hugo Villeneuve <[email protected]>
Date: Tue, 23 Jul 2024 08:53:01 -0400
Subject: [PATCH] serial: sc16is7xx: fix invalid FIFO access with special
register set
When enabling access to the special register set, Receiver time-out and RHR interrupts can happen. In this case, the IRQ handler will try to read from the FIFO thru the RHR register at address 0x00, but address 0x00 is mapped to DLL register, resulting in erroneous FIFO reading.
Call graph example:
sc16is7xx_startup(): entry
sc16is7xx_ms_proc(): entry
sc16is7xx_set_termios(): entry
sc16is7xx_set_baud(): DLH/DLL = $009C --> access special register set
sc16is7xx_port_irq() entry --> IIR is 0x0C
sc16is7xx_handle_rx() entry
sc16is7xx_fifo_read(): --> unable to access FIFO (RHR) because it is
mapped to DLL (LCR=LCR_CONF_MODE_A)
sc16is7xx_set_baud(): exit --> Restore access to general register setFix the problem by claiming the efr_lock mutex when accessing the Special register set.
drivers/tty/serial/sc16is7xx.c +4 -0
@@ -592,6 +592,8 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)SC16IS7XX_MCR_CLKSEL_BIT , prescaler == 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT); +mutex_lock (&one->efr_lock); +/* Backup LCR and access special register set (DLL/DLH) */ lcr =sc16is7xx_port_read (port,SC16IS7XX_LCR_REG ); sc16is7xx_port_write(port, SC16IS7XX_LCR_REG,
@@ -606,6 +608,8 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)/* Restore LCR and access to general register set */ sc16is7xx_port_write (port,SC16IS7XX_LCR_REG , lcr); +mutex_unlock (&one->efr_lock); +return DIV_ROUND_CLOSEST ((clk / prescaler) /16 , div); }