Skip to content

Commit 30b708f

Browse files
committed
Fix (hopefully) for DWC_MEMCPY kernel panics. Thanks to Naren Sankar for finding this
1 parent 0ec4154 commit 30b708f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/usb/host/dwc_otg/dwc_otg_hcd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,10 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
909909
return 0;
910910
#endif
911911

912+
if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info))
913+
urb->actual_length = urb->length;
914+
915+
912916
hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list);
913917

914918
/* Remove the host channel from the free list. */

drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,9 @@ static int urb_enqueue(struct usb_hcd *hcd,
668668
urb->number_of_packets,
669669
mem_flags == GFP_ATOMIC ? 1 : 0);
670670

671+
if(dwc_otg_urb == NULL)
672+
return -ENOMEM;
673+
671674
urb->hcpriv = dwc_otg_urb;
672675

673676
dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe),

0 commit comments

Comments
 (0)