On Tue, 22 Oct 2013, Jack Pham wrote: > From: Hemant Kumar <hemantk@xxxxxxxxxxxxxx> > > USB control transfers can contain an optional IN data stage, in which > case the xHCI driver would queue an additional TRB. The interrupt on > short packet (ISP) bit is set so that the host controller driver can > update the URB's actual_length field if packet is received has length > less than the queued buffer. > > A zero-length packet (ZLP) received during the data stage is a special > case of a short packet but is currently not handled properly since during > the subsequent status stage the driver ends up overwriting the > actual_length field with transfer_buffer_length, which was the original > buffer length. A function driver will then incorrectly interpret the > completed URB as being of full length. > > Fix this by setting a flag when a ZLP is received in the data stage so > that the urb->actual_length remains 0 and does not get overwritten in > the status stage. While Sarah might feel differently about this, my impression is that it would be better to keep urb->actual_length always up to date rather than to have a special flag for a zero-length data stage in a control transfer. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html