RE: [PATCH] usb: gadget: f_fs: report error if excess data received

From: Du, Changbin
Date: Mon May 16 2016 - 22:53:57 EST


> There appears to be no kfifo support for iov_iter though, so I just went
> with a simple buffer.
>
> I havenât looked at the patch too carefully so this is an RFC rather
> than an actual patch at this point. It does compile at least.
>
> Regardless, the more I thin about it, the more Iâm under the impression
> that the whole rounding up in f_fs was a mistake. And the more Iâm
> leaning towards ignoring the excess data set by the host.
>
> ---------- >8 ----------------------------------------------------------
> Subject: usb: gadget: f_fs: buffer data from âoversizedâ OUT requests
>
> f_fs rounds up read(2) requests to a multiple of a max packet size
> which means that host may provide more data than user has space for.
> So far, the excess data has been silently ignored.
>
> This introduces a buffer for a tail of such requests so that they are
> returned on next read instead of being ignored.
>

Congratulations finally reach an agreement, thanks Alan Stern and Michal.
Here just have a comment - the buffered data need be dropped when the
epfile is closed, because it means the session is terminated.