]> git.itanic.dy.fi Git - linux-stable/commit
drm/amdgpu: Fix potential double free and null pointer dereference
authorLiang He <windhl@126.com>
Tue, 22 Nov 2022 04:28:49 +0000 (12:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 29 Nov 2022 16:03:37 +0000 (11:03 -0500)
commitdfd0287bd3920e132a8dae2a0ec3d92eaff5f2dd
treeb18d31a270fb7e68080a362680d1402c94a46575
parent2c83e3fd928b9cb1e35340e58d4b1bd2eea23ed6
drm/amdgpu: Fix potential double free and null pointer dereference

In amdgpu_get_xgmi_hive(), we should not call kfree() after
kobject_put() as the PUT will call kfree().

In amdgpu_device_ip_init(), we need to check the returned *hive*
which can be NULL before we dereference it.

Signed-off-by: Liang He <windhl@126.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c