lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 31 Mar 2015 15:28:34 -0500
From:	Felipe Balbi <balbi@...com>
To:	"Baxter, Jim" <jim_baxter@...tor.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"Zapolskiy, Vladimir" <Vladimir_Zapolskiy@...tor.com>
Subject: Re: usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT

Hi,

(it helps if you Cc the maintainer too :-)

On Tue, Mar 31, 2015 at 07:53:39PM +0100, Baxter, Jim wrote:
> I have been looking at an issue where a phone that is the Function FS
> host sometimes locks up and causes the function:

which USB controller ? which kernel ? which platform ?

> static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data
> *io_data) in drivers/usb/gadget/function/f_fs.c to timeout after
> MAX_SCHEDULE_TIMEOUT jiffies.

yeah, that's pretty much "never timeout" :-)

> We are opening the ffs connection with the O_NONBLOCK option and this
> timeout seems to be far too long.

is this your own application ? How can I make sure it's correct ?

> The code causing the wait is here (line 834):
> 
> if (unlikely(ret < 0)) {
>     /* nop */
> } else if (unlikely(
>         wait_for_completion_interruptible(&done))) {

right, this is waiting for the previous usb_ep_queue() to complete. Why
hasn't it completed yet ? Do you have a USB sniffer to check if data has
passed over the wire ? Did the host shifted any token in the wire trying
to move data around ?

>     ret = -EINTR;
>     usb_ep_dequeue(ep->ep, req);
> } else {
> 
> The function call wait_for_completion_interruptible(&done) equates to:
> wait_for_completion_interruptible_timeout(&done, MAX_SCHEDULE_TIMEOUT);
> 
> 
> I was wondering what to change to fix this, is it reasonable to use a
> very small timeout if it is O_NONBLOCK or is any blocking not allowed?
> 
> I would appreciate any thoughts on how this should work?

sounds like a bug on your USB peripheral controller driver. Which one is
that ? Again, which kernel ? Where are the logs ?

regards

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ