Skip to content

Commit 178e00f

Browse files
SherrySun5gregkh
authored andcommitted
tty: serial: fsl_lpuart: fix crash in lpuart_uport_is_active
For serdev framework, tty->dev is a NULL pointer, lpuart_uport_is_active calling device_may_wakeup() may cause kernel NULL pointer crash, so here add the NULL pointer check before using it. Fixes: 4f5cb8c ("tty: serial: fsl_lpuart: enable wakeup source for lpuart") Cc: stable <stable@kernel.org> Signed-off-by: Sherry Sun <sherry.sun@nxp.com> Link: https://lore.kernel.org/r/20230323110923.24581-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9425914 commit 178e00f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2948,7 +2948,7 @@ static bool lpuart_uport_is_active(struct lpuart_port *sport)
29482948
tty = tty_port_tty_get(port);
29492949
if (tty) {
29502950
tty_dev = tty->dev;
2951-
may_wake = device_may_wakeup(tty_dev);
2951+
may_wake = tty_dev && device_may_wakeup(tty_dev);
29522952
tty_kref_put(tty);
29532953
}
29542954

0 commit comments

Comments
 (0)