Skip to content

Commit

Permalink
dwc_otg: Fix incorrect URB allocation error handling
Browse files Browse the repository at this point in the history
If the memory allocation for a dwc_otg_urb failed, the kernel would OOPS
because for some reason a member of the *unallocated* struct was set to
zero. Error handling changed to fail correctly.
  • Loading branch information
P33M authored and P33M committed Feb 15, 2013
1 parent 3e964c4 commit 8c3d773
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/usb/host/dwc_otg/dwc_otg_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3136,17 +3136,13 @@ dwc_otg_hcd_urb_t *dwc_otg_hcd_urb_alloc(dwc_otg_hcd_t * hcd,
else
dwc_otg_urb = DWC_ALLOC(size);

if (NULL != dwc_otg_urb)
dwc_otg_urb->packet_count = iso_desc_count;
if (dwc_otg_urb)
dwc_otg_urb->packet_count = iso_desc_count;
else {
dwc_otg_urb->packet_count = 0;
if (size != 0) {
DWC_ERROR("**** DWC OTG HCD URB alloc - "
"%salloc of %db failed\n",
atomic_alloc?"atomic ":"", size);
}
}

DWC_ERROR("**** DWC OTG HCD URB alloc - "
"%salloc of %db failed\n",
atomic_alloc?"atomic ":"", size);
}
return dwc_otg_urb;
}

Expand Down

0 comments on commit 8c3d773

Please sign in to comment.