tty: always relink the port

commit 273f632912 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: fb2b90014d ("tty: link tty and port before configuring it as console")
Reported-by: Kenneth R. Crudup <kenny@panix.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191227174434.12057-1-sudipm.mukherjee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Sudip Mukherjee 2019-12-27 17:44:34 +00:00 committed by Greg Kroah-Hartman
parent 46e4035d55
commit d32d6d2bee
1 changed files with 1 additions and 2 deletions

View File

@ -89,7 +89,6 @@ void tty_port_link_device(struct tty_port *port,
{ {
if (WARN_ON(index >= driver->num)) if (WARN_ON(index >= driver->num))
return; return;
if (!driver->ports[index])
driver->ports[index] = port; driver->ports[index] = port;
} }
EXPORT_SYMBOL_GPL(tty_port_link_device); EXPORT_SYMBOL_GPL(tty_port_link_device);