USB: host: isp116x: check return value after calling platform_get_resource()
[ Upstream commit 134a3408c2 ]
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220302033716.31272-1-nizhen@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0f69d7d5e9
commit
ee105039d3
1 changed files with 4 additions and 2 deletions
|
|
@ -1541,10 +1541,12 @@ static int isp116x_remove(struct platform_device *pdev)
|
|||
|
||||
iounmap(isp116x->data_reg);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
||||
release_mem_region(res->start, 2);
|
||||
if (res)
|
||||
release_mem_region(res->start, 2);
|
||||
iounmap(isp116x->addr_reg);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
release_mem_region(res->start, 2);
|
||||
if (res)
|
||||
release_mem_region(res->start, 2);
|
||||
|
||||
usb_put_hcd(hcd);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue