drm/amdgpu: fix IP instance memory leak on kobject add failure
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ a6c40b178092f41b9d6cc8615697c14b1e5a1c3a · < f5a5add3605935163dd0f75749b6a7869e9765af| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
drm/amdgpu: fix IP instance memory leak on kobject add failure
amdgpu_discovery_sysfs_ips() allocates ip_hw_instance with kzalloc_flex() and initializes its embedded kobject before calling kobject_add().
If kobject_add() fails, the return value is ignored and execution continues without dropping the initial kobject reference. The failed kobject is not retained in the kset list, so the normal sysfs teardown path cannot find it. As a result, ip_hw_instance_release() is never called and the ip_hw_instance allocation is leaked.
Call kobject_put() when kobject_add() fails so the initial reference is dropped and ip_hw_instance_release() can free the allocation. Keep the existing best-effort sysfs behavior by continuing with the remaining IP entries after the failed registration.
The issue was identified by a static analysis tool I developed and confirmed by manual review.
(cherry picked from commit 5c75fbcca8af1096d8d9415b91d8ea6212c22ee1)
From the CVE record · Linux
The Linux kernel's amdgpu IP discovery sysfs code leaks an allocation if kobject_add() fails. The input does not describe an attacker-triggered path or specify network access, authentication, or user interaction requirements.
Operators running the Linux kernel with amdgpu should check their versions against the vendor advisory; affected versions are not specified.