mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
serial: 8250_omap: set priv->line before enabling the IRQ
omap8250_irq() is requested in omap8250_probe() with IRQ_NOAUTOEN and
enabled only in omap_8250_startup(). The handler obtains the port by
serial8250_get_port(priv->line), but probe stores priv->line only after
serial8250_register_8250_port() returns.
The port becomes visible to userspace already inside
serial8250_register_8250_port() (uart_add_one_port()). So it can be
opened -- and the IRQ enabled -- before probe stores the line. An
interrupt in that window makes the handler call
serial8250_get_port(-ENODEV) and dereference a pointer outside of
serial8250_ports[].
Store the line in omap_8250_startup() before enable_irq(), so the
handler never runs with an unset line. Keep the assignment in probe
too, as remove and the system PM callbacks rely on it even when the
port was never opened.
Fixes: fef4f60031 ("serial: 8250: omap: Fix life cycle issues for interrupt handlers")
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Assisted-by: LLM
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/3b3a642f7df2285f49a7bbbe5d1c23fa442c7d94.1791873876.git.jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3e3ae95a3d
commit
8276a44f0a
|
|
@ -711,6 +711,9 @@ static int omap_8250_startup(struct uart_port *port)
|
|||
struct uart_8250_dma *dma = &priv->omap8250_dma;
|
||||
int ret;
|
||||
|
||||
/* ISR and runtime PM need the line; probe sets it only after registration */
|
||||
priv->line = port->line;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
up->capabilities |= UART_CAP_RPM;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user