Skip to content

Commit

Permalink
usb: fsl: Check memory resource before releasing it
Browse files Browse the repository at this point in the history
Check memory resource existence before releasing it to avoid NULL
pointer dereference

Signed-off-by: Nikhil Badola <[email protected]>
Reviewed-by: Ran Wang <[email protected]>
Reviewed-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
Nikhil Badola authored and felipebalbi committed Oct 27, 2019
1 parent a51bab5 commit bc1e3a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/udc/fsl_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2576,7 +2576,7 @@ static int fsl_udc_remove(struct platform_device *pdev)
dma_pool_destroy(udc_controller->td_pool);
free_irq(udc_controller->irq, udc_controller);
iounmap(dr_regs);
if (pdata->operating_mode == FSL_USB2_DR_DEVICE)
if (res && (pdata->operating_mode == FSL_USB2_DR_DEVICE))
release_mem_region(res->start, resource_size(res));

/* free udc --wait for the release() finished */
Expand Down

0 comments on commit bc1e3a2

Please sign in to comment.