diff options
author | Nikhil Badola <nikhil.badola@freescale.com> | 2015-05-11 07:45:18 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:27 (GMT) |
commit | 3523841d40a05cc0866ef4cce2f96b1ab06b4688 (patch) | |
tree | a071a31154615117ef725e3bffc29a9b6dd89e39 | |
parent | d00b8e730bc1a0269dc80a241cd470b832b449d8 (diff) | |
download | linux-3523841d40a05cc0866ef4cce2f96b1ab06b4688.tar.xz |
usb: fsl: Check memory resource before releasing it
Check memory resource existence before releasing it to avoid NULL
pointer dereference
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
-rw-r--r-- | drivers/usb/gadget/udc/fsl_udc_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index 240a5ac..26ae5b1 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -2577,7 +2577,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 */ |