From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com ([209.85.208.194]:45283 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbeLDQb6 (ORCPT ); Tue, 4 Dec 2018 11:31:58 -0500 Date: Tue, 4 Dec 2018 17:31:55 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , linux-usb@vger.kernel.org, Jarkko Nikula , Jiri Slaby , linux-kernel@vger.kernel.org, stable , Florian Zumbiehl Subject: Re: [PATCH] USB: serial: console: fix reported terminal settings Message-ID: <20181204163155.GD18087@localhost> References: <20181204155904.GC18087@localhost> <20181204160036.24625-1-johan@kernel.org> <20181204161518.GA17941@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181204161518.GA17941@kroah.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Dec 04, 2018 at 05:15:18PM +0100, Greg Kroah-Hartman wrote: > On Tue, Dec 04, 2018 at 05:00:36PM +0100, Johan Hovold wrote: > > The USB-serial console implementation has never reported the actual > > terminal settings used. Despite storing the corresponding cflags in its > > struct console, this was never honoured on later tty open() where the > > tty termios would be left initialised to the driver defaults. > > > > Unlike the serial console implementation, the USB-serial code calls > > subdriver open() already at console setup. While calling set_termios() > > before open() looks like it could work for some USB-serial drivers, > > others definitely do not expect this, so modelling this after serial > > core is going to be intrusive, if at all possible. > > > > Instead, use a (renamed) tty helper to save the termios data used at > > console setup, so that the tty termios reflects the actual terminal > > settings after a subsequent tty open(). > > > > Note that the calls to tty_init_termios() (tty_driver_install()) and > > tty_save_termios() are serialised using the disconnect mutex. > > > > This specifically fixes a regression that was triggered by a recent > > change adding software flow control to the pl2303 driver: a getty trying > > to disable flow control while leaving the baud rate unchanged would now > > also set the baud rate to the driver default (prior to the flow-control > > change this had been a noop). > > > > Fixes: 7041d9c3f01b ("USB: serial: pl2303: add support for tx xon/xoff flow control") > > Cc: stable # 4.18 > > Reported-by: Jarkko Nikula > > Cc: Florian Zumbiehl > > Signed-off-by: Johan Hovold > > --- > > drivers/tty/tty_io.c | 11 +++++++++-- > > drivers/usb/serial/console.c | 2 +- > > include/linux/tty.h | 1 + > > 3 files changed, 11 insertions(+), 3 deletions(-) > > Ah, messy :) > > Want me to take this through my tty tree? If you prefer. I was planning on including this in a USB-serial pull request for -rc6 since it fixes a user-reported regression, but perhaps taking this through your tty-linus branch (which already holds a console fix) is easier/faster. We should wait for Jarkko to confirm that this fixes the problem he reported first, though. Thanks, Johan