In the Linux kernel, the following vulnerability has been resolved:
drm/amdgpu: fix calltrace warning in amddrmbuddyfini
The following call trace is observed when removing the amdgpu driver, which is caused by that BOs allocated for psp are not freed until removing.
[61811.450562] RIP: 0010:amddrmbuddyfini.cold+0x29/0x47 [amddrmbuddy] [61811.450577] Call Trace: [61811.450577] <TASK> [61811.450579] amdgpuvrammgrfini+0x135/0x1c0 [amdgpu] [61811.450728] amdgputtmfini+0x207/0x290 [amdgpu] [61811.450870] amdgpubofini+0x27/0xa0 [amdgpu] [61811.451012] gmcv90swfini+0x4a/0x60 [amdgpu] [61811.451166] amdgpudevicefinisw+0x117/0x520 [amdgpu] [61811.451306] amdgpudriverreleasekms+0x16/0x30 [amdgpu] [61811.451447] devmdrmdevinitrelease+0x4d/0x80 [drm] [61811.451466] devmactionrelease+0x15/0x20 [61811.451469] releasenodes+0x40/0xb0 [61811.451471] devresreleaseall+0x9b/0xd0 [61811.451473] _devicereleasedriver+0x1bb/0x2a0 [61811.451476] driverdetach+0xf3/0x140 [61811.451479] busremovedriver+0x6c/0xf0 [61811.451481] driverunregister+0x31/0x60 [61811.451483] pciunregisterdriver+0x40/0x90 [61811.451486] amdgpu_exit+0x15/0x447 [amdgpu]
For smu v1302, if the GPU supports xgmi, refer to
commit f5c7e7797060 ("drm/amdgpu: Adjust removal control flow for smu v1302"),
it will run gpu recover in AMDGPURESETFORDEVICEREMOVE mode when removing, which makes all devices in hive list have hw reset but no resume except the basic ip blocks, then other ip blocks will not call .hwfini according to ipblock.status.hw.
Since pspfreesharedbufs just includes some software operations, so move it to pspsw_fini.