Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17275 closed bug (fixed)

[USB] Stack drivers do not properly handle non-isolated fragmented transfers

Reported by: waddlesplash Owned by: waddlesplash
Priority: normal Milestone: R1/beta4
Component: Drivers/USB Version: R1/beta3
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

In hrev55441, I implemented support for fragmented transfers in XHCI. However, upon further reflection, there is a critical problem here: if more than just the one fragmented transfer is queued at once, then all but the first part of the fragmented transfer will be inadvertently "interspersed" with parts of other transfers, which will cause data corruption, etc. among other problems.

Looking at EHCI and other stack drivers, it appears they all have this exact same oversight. I guess nothing that uses fragmented transfers queues multiple things at once, or else it already would have run into this issue.

Possibly the right thing to do in this case is just to return an error code. I'm not quite sure what the right one would be. Maybe B_DEV_RESOURCE_CONFLICT? Or just B_BUSY? "Too many requests" would be the real error code, but we do not have one for that.

Change History (10)

comment:1 by waddlesplash, 3 years ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: assignedclosed

Fixed in hrev55455.

comment:2 by ifelice, 3 years ago

Howdy,

I have been succesfully running Haiku from a USB SSD drive for several months.

After the hrev55455 commit, now my Haiku installation does not boot anymore. Specifically, it stops at the third icon of the boot screen.

comment:3 by X512, 3 years ago

The same for me. Updating to latest nightly caused permanent freeze when booting from USB 3 disk.

Version 0, edited 3 years ago by X512 (next)

comment:4 by bruno, 3 years ago

Here too... I added rhis ticket: https://dev.haiku-os.org/ticket/17289

comment:5 by waddlesplash, 3 years ago

Diver reports this is reproducible in VMware, I guess that makes this relatively easy to debug.

comment:6 by jmairboeck, 3 years ago

Could an endless loop cause the problem? Just looking at the code changes from hrev55455 (I didn't test anything!), it seems that while loops are used to iterate over transfers in EHCI, OHCI and UHCI, but the iterators are never incremented (for the case where there is no conflict).

comment:7 by waddlesplash, 3 years ago

Oops, yes, it appears that there is a copy/paste error there. Indeed that is probably the issue.

comment:8 by amonpaike, 3 years ago

it's not fixed, i upgraded to hrev55457 and haiku still won't boot

here my post describing the events, I thought it was about the intel video driver, but investigating more I found that it is not so, I have attached a photo showing where freeze.

https://discuss.haiku-os.org/t/improving-the-intel-extreme-driver-was-graphics-on-dell-laptop-in-vesa-mode-only/10583/250?u=amonpaike

comment:9 by waddlesplash, 3 years ago

Fixed that issue in hrev55459.

comment:10 by ifelice, 3 years ago

Booting OK in hrev55464. Thank you!

Note: See TracTickets for help on using tickets.