lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190114134821.GH3691@localhost>
Date:   Mon, 14 Jan 2019 14:48:21 +0100
From:   Johan Hovold <johan@...nel.org>
To:     Karoly Pados <pados@...os.hu>
Cc:     Johan Hovold <johan@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Loic Poulain <loic.poulain@...aro.org>
Subject: Re: [PATCH] USB: serial: ftdi_sio: Fix GPIO not working in
 autosuspend

On Mon, Jan 14, 2019 at 01:30:03PM +0100, Karoly Pados wrote:
> There is a bug in the current GPIO code for ftdi_sio: it failed to take USB
> autosuspend into account. If the device is in autosuspend, calls to
> usb_control_msg() fail with -EHOSTUNREACH. Because the standard value for
> autosuspend timeout is usually 2-5 seconds, this made it almost impossible
> to use the GPIOs on machines that have USB autosuspend enabled. This patch
> fixes the issue by acquiring a PM lock on the device for the duration of
> the USB transfers. Tested on an FT231X device.
> 
> Signed-off-by: Karoly Pados <pados@...os.hu>
> ---
> Please consider backporting to 4.20.x, otherwise the GPIO driver is not
> really usable for anybody with USB autosuspend enabled (eg. many laptops),
> at least not without manual configuration.
> 
>  drivers/usb/serial/ftdi_sio.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index 1ab2a6191013..01813dce37f2 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -1783,6 +1783,13 @@ static int ftdi_set_bitmode(struct usb_serial_port *port, u8 mode)
>  	int result;
>  	u16 val;
>  
> +	result = usb_autopm_get_interface(port->serial->interface);

Both of the functions where you add autopm calls already have a local
variable for port->serial.

> +	if (result) {
> +		dev_err(&port->serial->interface->dev,
> +			"Failed to wake device from autosuspend.\n");

And we tend not to log errors for these calls.

> +		return result;
> +	}

I replaced and port->serial with serial and dropped the dev_err:s before
applying for -rc3 with a Fixes and CC-stable tag.

Thanks,
Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ