Commit 79fcd446 authored by xinhui pan's avatar xinhui pan Committed by Alex Deucher

drm/amdgpu: Fix memory leak

drm_gem_object_put() should be paired with drm_gem_object_lookup().

All gem objs are saved in fb->base.obj[]. Need put the old first before
assign a new obj.

Trigger VRAM leak by running command below
$ service gdm restart
Signed-off-by: default avatarxinhui pan <xinhui.pan@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0303e1b7
......@@ -955,8 +955,9 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
}
for (i = 1; i < rfb->base.format->num_planes; ++i) {
drm_gem_object_get(rfb->base.obj[0]);
drm_gem_object_put(rfb->base.obj[i]);
rfb->base.obj[i] = rfb->base.obj[0];
drm_gem_object_get(rfb->base.obj[i]);
}
return 0;
......@@ -1002,6 +1003,7 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
return ERR_PTR(ret);
}
drm_gem_object_put(obj);
return &amdgpu_fb->base;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment