Commit 1065a197 authored by Nikhil Badola's avatar Nikhil Badola Committed by Kleber Sacilotto de Souza

usb: fsl: Check memory resource before releasing it

BugLink: https://bugs.launchpad.net/bugs/1852335

[ Upstream commit bc1e3a2d ]

Check memory resource existence before releasing it to avoid NULL
pointer dereference
Signed-off-by: default avatarNikhil Badola <nikhil.badola@freescale.com>
Reviewed-by: default avatarRan Wang <ran.wang_1@nxp.com>
Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 430e21c3
...@@ -2570,7 +2570,7 @@ static int fsl_udc_remove(struct platform_device *pdev) ...@@ -2570,7 +2570,7 @@ static int fsl_udc_remove(struct platform_device *pdev)
dma_pool_destroy(udc_controller->td_pool); dma_pool_destroy(udc_controller->td_pool);
free_irq(udc_controller->irq, udc_controller); free_irq(udc_controller->irq, udc_controller);
iounmap(dr_regs); 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)); release_mem_region(res->start, resource_size(res));
/* free udc --wait for the release() finished */ /* free udc --wait for the release() finished */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment