Skip to content

Commit 3fc4648

Browse files
Pratap Nirujogialexdeucher
authored andcommitted
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: 057edc5 ("ACPI: PM: Register wakeup sources under physical devices") Suggested-by: Bin Du <Bin.Du@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit c51632d)
1 parent f39e127 commit 3fc4648

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int isp_genpd_add_device(struct device *dev, void *data)
129129
if (!pdev)
130130
return -EINVAL;
131131

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

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

0 commit comments

Comments
 (0)