Re: [PATCH] USB: g_file_storage: fix handling zero-length packet

From: David Brownell
Date: Sun Sep 07 2008 - 00:35:25 EST


On Saturday 06 September 2008, Alan Stern wrote:
> Secondly, the patch is not needed.  g_file_storage doesn't have to
> check whether the data size is a multiple of MaxPacketSize because the
> device controller driver already is supposed to make that check.

Exactly.

The only fuzziness here is what to do if the host misbehaves and
sends another IN packet when all its data has been sent, instead
of the OUT/STATUS packet. (Host error...)

Most peripheral controller hardware is well enough designed that
it can detect this and send a zero length packet rather than STALL
the transfer. It's polite to do so, because that host bug isn't
exactly unknown. (Some old versions of Linux did that...)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/