Commit 3fc4648b authored by Pratap Nirujogi's avatar Pratap Nirujogi Committed by Alex Deucher
Browse files

drm/amdgpu: Fix ISP segfault issue in kernel v7.0



Add NULL pointer checks for dev->type before accessing
dev->type->name in ISP genpd add/remove functions to
prevent kernel crashes.

This regression was introduced in v7.0 as the wakeup sources
are registered using physical device instead of ACPI device.
This led to adding wakeup source device as the first child of
AMDGPU device without initializing dev-type variable, and
resulted in segfault when accessed it in the amdgpu isp driver.

Fixes: 057edc58 ("ACPI: PM: Register wakeup sources under physical devices")
Suggested-by: default avatarBin Du <Bin.Du@amd.com>
Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarPratap Nirujogi <pratap.nirujogi@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit c51632d1)
parent f39e1270
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ static int isp_genpd_add_device(struct device *dev, void *data)
	if (!pdev)
		return -EINVAL;

	if (!dev->type->name) {
	if (!dev->type || !dev->type->name) {
		drm_dbg(&adev->ddev, "Invalid device type to add\n");
		goto exit;
	}
@@ -165,7 +165,7 @@ static int isp_genpd_remove_device(struct device *dev, void *data)
	if (!pdev)
		return -EINVAL;

	if (!dev->type->name) {
	if (!dev->type || !dev->type->name) {
		drm_dbg(&adev->ddev, "Invalid device type to remove\n");
		goto exit;
	}