]> git.baikalelectronics.ru Git - kernel.git/commit
serdev: ttyport: restore client ops on deregistration
authorJohan Hovold <johan@kernel.org>
Mon, 10 Feb 2020 14:57:30 +0000 (15:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 16:22:19 +0000 (17:22 +0100)
commitcb5a0d026ade3a504f5e8a2cf899d12b340d8e79
treee32c7581983702e70fcb723d39cfae025af4eba7
parentd471ebdb9007ccefd8112b6cb6cddda207ceeba8
serdev: ttyport: restore client ops on deregistration

commit 9e9f3dcaad57cab53a01c71fb072f332b50a1f5a upstream.

The serdev tty-port controller driver should reset the tty-port client
operations also on deregistration to avoid a NULL-pointer dereference in
case the port is later re-registered as a normal tty device.

Note that this can only happen with tty drivers such as 8250 which have
statically allocated port structures that can end up being reused and
where a later registration would not register a serdev controller (e.g.
due to registration errors or if the devicetree has been changed in
between).

Specifically, this can be an issue for any statically defined ports that
would be registered by 8250 core when an 8250 driver is being unbound.

Fixes: 5ceffbe4eb6c ("serdev: add a tty port controller driver")
Cc: stable <stable@vger.kernel.org> # 4.11
Reported-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200210145730.22762-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serdev/serdev-ttyport.c
drivers/tty/tty_port.c
include/linux/tty.h