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: <20201030232400.GA3090@b29397-desktop>
Date:   Fri, 30 Oct 2020 23:24:29 +0000
From:   Peter Chen <peter.chen@....com>
To:     Michael R Sweet <msweet@...eet.org>
CC:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Fix default q_len for usb_f_printer gadget driver

On 20-10-30 18:34:19, Michael R Sweet wrote:
> The usb_f_printer gadget driver uses a default q_len value of *0* which prevents
> any IO from occurring.  Moreover, once the driver is instantiated it is
> impossible to change the q_len value.
> 
> The following patch uses a default q_len value of 10 which matches the legacy
> g_printer gadget driver.  This minimizes the possibility that you end up with a
> non-working printer gadget.  It is still possible to set the q_len to a
> different value using the configfs path of the same name.
> 
> Signed-off-by: Michael R Sweet <msweet@...eet.org>

Reviewed-by: Peter Chen <peter.chen@....com>

Peter
> ---
>  drivers/usb/gadget/function/f_printer.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
> index 9c7ed2539ff7..4f3161005e4f 100644
> --- a/drivers/usb/gadget/function/f_printer.c
> +++ b/drivers/usb/gadget/function/f_printer.c
> @@ -50,6 +50,8 @@
>  #define GET_PORT_STATUS		1
>  #define SOFT_RESET		2
>  
> +#define DEFAULT_Q_LEN		10 /* same as legacy g_printer gadget */
> +
>  static int major, minors;
>  static struct class *usb_gadget_class;
>  static DEFINE_IDA(printer_ida);
> @@ -1317,6 +1319,9 @@ static struct usb_function_instance *gprinter_alloc_inst(void)
>  	opts->func_inst.free_func_inst = gprinter_free_inst;
>  	ret = &opts->func_inst;
>  
> +	/* Make sure q_len is initialized, otherwise the bound device can't support read/write! */
> +	opts->q_len = DEFAULT_Q_LEN;
> +
>  	mutex_lock(&printer_ida_lock);
>  
>  	if (ida_is_empty(&printer_ida)) {
> -- 
> 2.17.1
> 

-- 

Thanks,
Peter Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ