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]
Date:	Thu, 16 Jun 2011 19:25:36 +0300
From:	Felipe Balbi <balbi@...com>
To:	Tatyana Brokhman <tlinder@...eaurora.org>
Cc:	greg@...ah.com, linux-usb@...r.kernel.org,
	linux-arm-msm@...r.kernel.org, balbi@...com, ablay@...eaurora.org,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH/RFC 3/5] usb:g_zero: bulk in/out unittest support

Hi,

On Thu, Jun 16, 2011 at 04:31:05PM +0300, Tatyana Brokhman wrote:
> This commit adds a new vendor specific request to be handled by the
> g_zero module in it's sourcesink configuration. The purpose if this
> request is to update the length of the BULK transfer to a given value.
> The bRequest value of the new control request is 0x5e.
> It is used by the user-space Unit testing application for bulk in/out
> tests.
> 
> Signed-off-by: Tatyana Brokhman <tlinder@...eaurora.org>
> 
> ---
>  drivers/usb/gadget/f_sourcesink.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c
> index caf2f95..d417b8a 100644
> --- a/drivers/usb/gadget/f_sourcesink.c
> +++ b/drivers/usb/gadget/f_sourcesink.c
> @@ -70,6 +70,7 @@ static unsigned pattern;
>  module_param(pattern, uint, 0);
>  MODULE_PARM_DESC(pattern, "0 = all zeroes, 1 = mod63 ");
>  
> +static struct f_sourcesink	*the_sourcesink;

this is a big no-no. f_*.c should always be able to be instantiated as
many times as we need.

>  /*-------------------------------------------------------------------------*/
>  
>  static struct usb_interface_descriptor source_sink_intf = {
> @@ -197,6 +198,7 @@ static void
>  sourcesink_unbind(struct usb_configuration *c, struct usb_function *f)
>  {
>  	kfree(func_to_ss(f));
> +	the_sourcesink = NULL;
>  }
>  
>  /* optionally require specific source/sink data patterns  */
> @@ -425,6 +427,7 @@ static int __init sourcesink_bind_config(struct usb_configuration *c)
>  	status = usb_add_function(c, &ss->function);
>  	if (status)
>  		kfree(ss);
> +	the_sourcesink = ss;
>  	return status;
>  }
>  
> @@ -472,6 +475,15 @@ static int sourcesink_setup(struct usb_configuration *c,
>  		value = w_length;
>  		break;
>  
> +	case 0x5e:
> +		/*
> +		 * Change bulk ep buffer size. buflen is the length of
> +		 * the BULK transfer (req->length=buflen). Defined in g_zero.h
> +		 */
> +		disable_source_sink(the_sourcesink);
> +		buflen = w_value;
> +		value = enable_source_sink(c->cdev, the_sourcesink);
> +		break;
>  	default:

I think this request, should be handled by the f_sourcesink interface.
Meaning you'd need to introduce another f_sourcesink_setup(); to be
added to the function, rather then the configuration.

Please change that.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ