[PATCH] drm/amdgpu: Call drm_framebuffer_init last for framebuffer init

Alex Deucher alexdeucher at gmail.com
Fri Jun 18 20:51:51 UTC 2021


Applied.  Thanks!

Alex

On Thu, Jun 17, 2021 at 6:33 AM Michel Dänzer <michel at daenzer.net> wrote:
>
> On 2021-06-16 12:46 p.m., Michel Dänzer wrote:
> > From: Michel Dänzer <mdaenzer at redhat.com>
> >
> > Once drm_framebuffer_init has returned 0, the framebuffer is hooked up
> > to the reference counting machinery and can no longer be destroyed with
> > a simple kfree. Therefore, it must be called last.
> >
> > Fixes: f258907fdd835e "drm/amdgpu: Verify bo size can fit framebuffer size on init."
>
> In case the commit log wasn't clear: If drm_framebuffer_init returns 0 but its caller then returns non-0, there will likely be memory corruption fireworks down the road. The following lead me to this fix:
>
> [   12.891228] kernel BUG at lib/list_debug.c:25!
> [...]
> [   12.891263] RIP: 0010:__list_add_valid+0x4b/0x70
> [...]
> [   12.891324] Call Trace:
> [   12.891330]  drm_framebuffer_init+0xb5/0x100 [drm]
> [   12.891378]  amdgpu_display_gem_fb_verify_and_init+0x47/0x120 [amdgpu]
> [   12.891592]  ? amdgpu_display_user_framebuffer_create+0x10d/0x1f0 [amdgpu]
> [   12.891794]  amdgpu_display_user_framebuffer_create+0x126/0x1f0 [amdgpu]
> [   12.891995]  drm_internal_framebuffer_create+0x378/0x3f0 [drm]
> [   12.892036]  ? drm_internal_framebuffer_create+0x3f0/0x3f0 [drm]
> [   12.892075]  drm_mode_addfb2+0x34/0xd0 [drm]
> [   12.892115]  ? drm_internal_framebuffer_create+0x3f0/0x3f0 [drm]
> [   12.892153]  drm_ioctl_kernel+0xe2/0x150 [drm]
> [   12.892193]  drm_ioctl+0x3da/0x460 [drm]
> [   12.892232]  ? drm_internal_framebuffer_create+0x3f0/0x3f0 [drm]
> [   12.892274]  amdgpu_drm_ioctl+0x43/0x80 [amdgpu]
> [   12.892475]  __se_sys_ioctl+0x72/0xc0
> [   12.892483]  do_syscall_64+0x33/0x40
> [   12.892491]  entry_SYSCALL_64_after_hwframe+0x44/0xae
>
>
>
> --
> Earthling Michel Dänzer               |               https://redhat.com
> Libre software enthusiast             |             Mesa and X developer
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list