Skip to content

Commit

Permalink
USB: host: isp116x: check return value after calling platform_get_res…
Browse files Browse the repository at this point in the history
…ource()

[ Upstream commit 134a340 ]

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>
  • Loading branch information
nizhenth authored and gregkh committed Jun 14, 2022
1 parent 0f69d7d commit ee10503
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/usb/host/isp116x-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee10503

Please sign in to comment.