From: Sudip Mukherjee Date: Fri, 27 Dec 2019 17:44:34 +0000 (+0000) Subject: tty: always relink the port X-Git-Tag: v3.16.83~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b426e4aecfed58107dcf6400a1b809eda25f16d;p=thirdparty%2Fkernel%2Fstable.git tty: always relink the port commit 273f632912f1b24b642ba5b7eb5022e43a72f3b5 upstream. If the serial device is disconnected and reconnected, it re-enumerates properly but does not link it. fwiw, linking means just saving the port index, so allow it always as there is no harm in saving the same value again even if it tries to relink with the same port. Fixes: fb2b90014d78 ("tty: link tty and port before configuring it as console") Reported-by: Kenneth R. Crudup Signed-off-by: Sudip Mukherjee Link: https://lore.kernel.org/r/20191227174434.12057-1-sudipm.mukherjee@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index bfdd93ab24721..3f746c8eb0dd4 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -49,8 +49,7 @@ void tty_port_link_device(struct tty_port *port, { if (WARN_ON(index >= driver->num)) return; - if (!driver->ports[index]) - driver->ports[index] = port; + driver->ports[index] = port; } EXPORT_SYMBOL_GPL(tty_port_link_device);