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-next>] [day] [month] [year] [list]
Date:	Sat, 06 Sep 2008 00:51:10 -0400
From:	sangsu <sangsu@...il.com>
To:	dbrownell@...rs.sourceforge.net, gregkh@...e.de,
	stern@...land.harvard.edu, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] USB: g_file_storage: fix handling zero-length packet 

According to "CH 5.5.3. Control Transfer Packet Size Constraints",
Zero-length packet should be sent when the last data payload size
is equal to the endpoint's MaxPacketSize. This patch helps
g_file_storage send zero-length packet properly.

This is tested in s3c2440/s5c7329 architectures and works well.

Signed-off-by: SangSu Park<sangsu@...il.com>
---
driver/usb/gadget/file_storage.c | 3++-
1 files changed, 2 insertion(+), 1 deletions(-)

--- a/drivers/usb/gadget/file_storage.c	2008-09-01 11:13:03.000000000 -0400
+++ b/drivers/usb/gadget/file_storage.c	2008-09-01 11:16:41.000000000 -0400
@@ -1463,7 +1463,8 @@
	if (rc >= 0 && rc != DELAYED_STATUS) {
		rc = min(rc, w_length);
		fsg->ep0req->length = rc;
-		fsg->ep0req->zero = rc < w_length;
+		fsg->ep0req->zero = rc < w_length
+			&& (rc % gadget->ep0->maxpacket) == 0;
		fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ?
				"ep0-in" : "ep0-out");
		rc = ep0_queue(fsg);
--
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