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 16:31:05 +0300
From:	Tatyana Brokhman <tlinder@...eaurora.org>
To:	greg@...ah.com
Cc:	linux-usb@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	balbi@...com, ablay@...eaurora.org,
	Tatyana Brokhman <tlinder@...eaurora.org>,
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH/RFC 3/5] usb:g_zero: bulk in/out unittest support

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;
 /*-------------------------------------------------------------------------*/
 
 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:
 unknown:
 		VDBG(c->cdev,
-- 
1.7.3.3

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ