Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3825db88 authored by Zhen Ni's avatar Zhen Ni Committed by Greg Kroah-Hartman
Browse files

USB: host: isp116x: check return value after calling platform_get_resource()



[ Upstream commit 134a3408c2d3f7e23eb0e4556e0a2d9f36c2614e ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: default avatarZhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220302033716.31272-1-nizhen@uniontech.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 08bacf87
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1541,9 +1541,11 @@ static int isp116x_remove(struct platform_device *pdev)

	iounmap(isp116x->data_reg);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	if (res)
		release_mem_region(res->start, 2);
	iounmap(isp116x->addr_reg);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (res)
		release_mem_region(res->start, 2);

	usb_put_hcd(hcd);