]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
serial: sc16is7xx: fix invalid FIFO access with special register set
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Tue, 23 Jul 2024 12:53:01 +0000 (08:53 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2024 13:34:31 +0000 (15:34 +0200)
commit6a6730812220a9a5ce4003eb347da1ee5abd06b0
treef36898cc7f49bf9bc5a4eef069791aa5ab938308
parent09cfe05e9907f3276887a20e267cc40e202f4fdd
serial: sc16is7xx: fix invalid FIFO access with special register set

commit 7d3b793faaab1305994ce568b59d61927235f57b upstream.

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 set

Fix the problem by claiming the efr_lock mutex when accessing the Special
register set.

Fixes: dfeae619d781 ("serial: sc16is7xx")
Cc: stable@vger.kernel.org
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20240723125302.1305372-3-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sc16is7xx.c