]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc2: host: fix logical omissions in dwc2_process_non_isoc_desc
authorVardan Mikayelyan <mvardan@synopsys.com>
Tue, 16 Feb 2016 23:01:53 +0000 (15:01 -0800)
committerFelipe Balbi <balbi@kernel.org>
Wed, 17 Feb 2016 08:32:01 +0000 (10:32 +0200)
commitbcc48d887397f10f32f681113546e5b6e4a29e24
tree3b30002e20da753a9a37af23a4d39cdaa3b9da37
parent9cae45c987de2fd2930004c7442a6165c514df57
usb: dwc2: host: fix logical omissions in dwc2_process_non_isoc_desc

Fixes memory manipulation issues and makes Host DDMA bulk transfers
work.

dwc2_process_non_isoc_desc() must return non zero value ONLY when
failure happens in one of the queued descriptors. After receiving
non zero value the caller must stop processing of remaining
QTDs and their descriptors from chain.

Commit 882a2faed21c8e22 ("usb: dwc2: host: fix use of qtd after
free in desc dma mode") breaks non_isoc transaction completion logic
in Host DDMA mode. There were bugs before that, but after this patch
dwc2_process_non_isoc_desc() returns fail status even if descriptor
was processed normally. This causes break from loop which is processing
remaining descriptors assigned to QTD, which is not correct for QTDs
containing more than one descriptor.

Current dwc2 driver gathers queued BULK URBs until receiving URB
without URB_NO_INTERRUPT flag. Once getting it, SW creates
descriptor chain, stores it in qh structure and passes start
address to HW. Multiple URB data is contained in that chain.
Hence on getting error on descriptor after its processing by HW,
SW should go out of both loops(qh->qtd, qtd->descs) and report
the failure.

Fixes: 882a2faed21c8e22 ("usb: dwc2: host: fix use of qtd after free in desc dma mode")
Cc: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc2/hcd_ddma.c