[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A05D2F183@SHSMSX103.ccr.corp.intel.com>
Date: Thu, 12 May 2016 08:16:35 +0000
From: "Du, Changbin" <changbin.du@...el.com>
To: Felipe Balbi <felipe.balbi@...ux.intel.com>
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
> > The extra bytes can be anything(random), they just data from APP layer.
> > It doesn't make sense for you to check. So I will not dump them, sorry.
>
> interesting, so you claim to have found a bug, but when asked to provide
> more information your answer is "no" ? Thanks :-)
>
Do you really want a random hex string? I don't think it is useful.
> >> > The problem is device side app sometimes received incorrect data
> caused
> >> > by the dropping. Most times the error can be detected by APP itself, but
> >>
> >> why ? app did e.g. read(5), that caused driver to queue a usb_request
> >> with length set to 512. Host sent more data than the expected 5 bytes,
> >> why did host do that ? And if that data was needed, why didn't userspace
> >> read() more than 5 ?
> >>
> >
> > Well, first, there must be a protocol upon usb between host side and
> > device side.
>
> sorry, I don't know what mean here. USB does not *require* a protocol
> running on top of USB. There usually is one, but that's not a
> requirement.
>
Communication between two endpoints must has a protocol, even it may
very simple. Without protocol, they cannot exchange information.
> > Second device side didn't know how many bytes to receive, it need host
> > side tell it.
>
> well, many protocols work like this. See Mass Storage, for example.
>
> > But host could be buggy,
>
> if host is buggy, why should we fix host on the peripheral side ?
>
True it is bug of host, but is it a reason kernel can drop data then?
> > or the application is killed and restart.
>
> If application is killed (why was the application killed? Which
> application was killed?), then why are we still connected to host at
> all? It's clear that this gadget can't work without its userspace
> counterpart. If that userspace isn't available, we should drop data
> pullup and disconnect from host.
>
Usb no need disconnect if the application exit (host side). Seems you
only care about device side.
> > These all can lead host send more than device wanted bytes. For sure
> > it wrong at host side, but device side don't know.
>
> but none of this means we have a bug at device side. In fact, by
> allowing these extra bytes to reach userspace, we could be creating a
> possible attack vector.
>
> Your explanation is unsatisfactory, so I won't apply your patch, sorry.
>
> --
> balbi
It is fine. Then need userspace take care of all the data it received. Because
Kernel may drop some data for it. Kernel ffs driver is unauthentic sometimes.
Best Regards,
Du, Changbin
Powered by blists - more mailing lists