mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-16 00:58:42 -05:00
Revert "drm/amdgpu: Use dma_buf from GEM object instance"
This reverts commit515986100d. The dma_buf field in struct drm_gem_object is not stable over the object instance's lifetime. The field becomes NULL when user space releases the final GEM handle on the buffer object. This resulted in a NULL-pointer deref. Workarounds in commit5307dce878("drm/gem: Acquire references on GEM handles for framebuffers") and commitf6bfc9afc7("drm/framebuffer: Acquire internal references on GEM handles") only solved the problem partially. They especially don't work for buffer objects without a DRM framebuffer associated. Hence, this revert to going back to using .import_attach->dmabuf. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch> Acked-by: Alex Deucher <alexander.deucher@amd.com> Link: https://lore.kernel.org/r/20250715082635.34974-1-tzimmermann@suse.de
This commit is contained in:
@@ -514,7 +514,7 @@ bool amdgpu_dmabuf_is_xgmi_accessible(struct amdgpu_device *adev,
|
||||
return false;
|
||||
|
||||
if (drm_gem_is_imported(obj)) {
|
||||
struct dma_buf *dma_buf = obj->dma_buf;
|
||||
struct dma_buf *dma_buf = obj->import_attach->dmabuf;
|
||||
|
||||
if (dma_buf->ops != &amdgpu_dmabuf_ops)
|
||||
/* No XGMI with non AMD GPUs */
|
||||
|
||||
@@ -317,7 +317,8 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj,
|
||||
*/
|
||||
if (!vm->is_compute_context || !vm->process_info)
|
||||
return 0;
|
||||
if (!drm_gem_is_imported(obj) || !dma_buf_is_dynamic(obj->dma_buf))
|
||||
if (!drm_gem_is_imported(obj) ||
|
||||
!dma_buf_is_dynamic(obj->import_attach->dmabuf))
|
||||
return 0;
|
||||
mutex_lock_nested(&vm->process_info->lock, 1);
|
||||
if (!WARN_ON(!vm->process_info->eviction_fence)) {
|
||||
|
||||
@@ -1276,7 +1276,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
|
||||
struct drm_gem_object *obj = &bo->tbo.base;
|
||||
|
||||
if (drm_gem_is_imported(obj) && bo_va->is_xgmi) {
|
||||
struct dma_buf *dma_buf = obj->dma_buf;
|
||||
struct dma_buf *dma_buf = obj->import_attach->dmabuf;
|
||||
struct drm_gem_object *gobj = dma_buf->priv;
|
||||
struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user