mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
usb: dwc3: Avoid NULL pointer access in dwc3_calc_trbs_left
dwc3_calc_trbs_left function is calling dwc3_ep_prev_trb which can return NULL if trb pool is empty. This change adds check for the return value of dwc3_ep_prev_trb function to avoid NULL pointer dereference. Change-Id: Id11d5ffd23da7c070d5e0b26842d8738b073b212 Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
bd1c66bfdb
commit
7972f5f996
1 changed files with 1 additions and 1 deletions
|
|
@ -1002,7 +1002,7 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
|
|||
*/
|
||||
if (dep->trb_enqueue == dep->trb_dequeue) {
|
||||
tmp = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
|
||||
if (tmp->ctrl & DWC3_TRB_CTRL_HWO)
|
||||
if (!tmp || tmp->ctrl & DWC3_TRB_CTRL_HWO)
|
||||
return 0;
|
||||
|
||||
return DWC3_TRB_NUM - 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue