[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A05D2F5C3@SHSMSX103.ccr.corp.intel.com>
Date: Fri, 13 May 2016 05:52:52 +0000
From: "Du, Changbin" <changbin.du@...el.com>
To: Felipe Balbi <felipe.balbi@...ux.intel.com>,
Al Viro <viro@...iv.linux.org.uk>
CC: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"mina86@...a86.com" <mina86@...a86.com>,
"rui.silva@...aro.org" <rui.silva@...aro.org>,
"k.opasiak@...sung.com" <k.opasiak@...sung.com>,
"lars@...afoo.de" <lars@...afoo.de>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: gadget: f_fs: report error if excess data received
> Hi,
>
> "Du, Changbin" <changbin.du@...el.com> writes:
> >> right, and that was my point: if we copy more to userspace, then we have
> >> a real big problem.
> >>
> > Yes, we drop the data because we userspace buffer is not enough this time.
> > The problem here is that really can we just drop it silently? Maybe not.
>
> Yeah, it probably deserves a pr_err() or pr_debug(), but host sending
> more data than it should, is another problem altogether which needs to
> be addressed at the host.
>
> Adding a print to aid debugging is a good idea, but bailing out on the
> peripheral side is not :-s
>
Ok, if we think this is a problem at host side that the transfer is not device
expected, then device side should not accept the data or deliver the
transferred data to userspace. But now we take part of the data to userspace
and says it is ok.
Do you agree with this point?
IMO, we expose usb transfer as a file on device side. But file read() doesn't
have a requirement that "sorry, you cannot read so little! you need read all
once, else we may drop data for you. :) ".
And some library that may retry read() until get enough data (which is normal
For a general read). Then sometimes the buffer size for sys_read may not as
expected. This is why I think ioctl approach is more appropriate for usb transfer.
> --
> Balbi
Best Regards,
Du, Changbin
Powered by blists - more mailing lists